You are on page 1of 5
Difference in C++ By Yatharth Chauhan oop Cree eu Program is divided into objects Ce ET ects Te ee a en rar c Carice Pie eck POC} eer ear a Ly (rae TY POP Samet ee) er Ue eon ats ee ec eu Cu ee en eee eras ifier. DO ena Da eC ere Cerra boolean bool character char wehar_t charl6_t char32_t integer short int long long long floating point | float double. | long double re aay eae Basic A copy of actual parameters is passed into formal parameters, Effect Changes in formal, parameters will not result in changes in actual parameters. Memory Separate memory allocation location is allocated for actual and formal parameters. 1 byte 1 byte 1 byte | 2 bytes bytes | 2 bytes 2bytes | Abytes 8 bytes | bytes 8 bytes | 8 bytes Seca Reference of actual parameters is passed into formal, parameters. Changes in formal parameters will result in changes in actual parameters. Same memory location is allocated for actual and formal parameters. Always exactly 1 byte Call by Seed ‘Address of actual parameters is passed into formal parameters. Changes in format parameters will result, in ‘changes in actual parameters. ‘Same memory location is allocated for ‘actual and formal parameters. Sr Key Static Non-Static No. ‘Access Astatic variable can be Anon-static variable can not be ; accessed by static members as_ accessed by static member well as non-static member functions. functions. Sharing A static variable acts as a global A non-static variables are 2 variable and is shared among all_specific to instance object in the objects of the class. which they are created, Memory Static variables occupies less A non-static variable may allocation space and memory allocation _ occupy more space. Memory . happens once. allocation may happen at run time. Keyword Astatic variable is declared Anormal variable is not 4 using static keyword. required to have any special keyword. Class Interface Aclass describes the attributes and An interface contains behaviors that a behaviors of an object. class implements class may contain abstract methods, An interface contains only abstract concrete methods. methods. Members of a class can be public, All the members of the interface are private, protected or default. Public by default. rash 1s) Pitas Rect The scope is the same The scope is different Signatures must differ (ex: Signatures must be same parameter) Number of overloading functions| Only one overriding function possible possible It mainly occurs due to May occur without inheritance | inheritance Tyee) ios class is topmost class in the stream classes hierarchy. Itis the base class for istream, ostream, and streambuf class. The ios class is responsible for providing all input and output facilities to all other stream classes. This class is responsible for handling input stream. It provides number of function for handling chars, strings and objects such as get, getline, read ete... This class is responsible for handling output stream. It provides number of function for handling chars, strings and objects such as write, put etc.. This class is responsible for handling both input and output stream as both istream class and ostream class is inherited into it. It provides function of both istream class and ostream class, for handling chars, strings and objects. Itis an elaborated base class designed to provide a uniform public interface for all derived classes. ee) This Stream class signifies the input file stream and is applied for reading information from files. This Stream class signifies the output file stream and is applied to create files for writing information to files. This Stream class can be used for both read and write from/to files. Stream buffer to read from and write to files. Itis the base class for ifstream, ofstream, and fstream classes. Functions such are open() and. close() are defined in this class. {stream: It allows simultaneous input and output operations on filebuf. This class inherits istream and ostream classes File Mode Parameters PARAMETER Tos: Tos: Tos: Tos::i los:: Tos: Tos: Tos:: nocreate ‘noreplace out ‘trunc MEANING Append to end-of file goto end of file on opening binary file open fails if file doesn’t exist open fails if file already exists Deletes contents if it exists

You might also like