Major Differences Between C And C++
C | C++ |
C follows the procedural programming paradigm | C++ is a multi-paradigm language(procedural as well as object oriented)
|
In case of C, importance is given to the steps or procedure of the program | C++ focuses on the data rather than the process. |
. In case of C, the data is not secured | the data is secured(hidden) in C+ |
C is a low-level language | C++ is a middle-level language
|
C uses the top-down approach | C++ uses the bottom-up approach
|
C is function-driven & Functions are the building blocks of a C program | C++ is object-driven & objects are building blocks of a C++ program.
|
We cannot use function inside the structure | We can use function inside the structure |
C uses scanf & printf | C++ uses cin>> & cout<< |
C doesnot allows reference varaibles | C++ allows the use of reference variables |
Difference between a copy constructor and an assignment operator.
Copy Constructor | Assignment Operator |
Copy constructor creates a new object which has the copy of the original object.
|
On the other hand assignment operators does not create any new object. It instead, deals with existing objects.
|
Difference between "C structure" and "C++ Structure".
or
Define classes and structure.
Class | Structure |
User defined data type which contains data and methods to manipulate that data; is known as class. | A structure is a collection of variables, referenced under one name, providing a convenient means of keeping related information together. |
Each object is associated with the data of type class with which it is created. | Structure declaration forms a template which can be used to create structure objects. |
An object is a variable of a Class. | variables inside a structure are called members. |
Class declaration precedes the keyword Class.
| Structure declaration precedes the keyword struct.
|
Eg.
| example: struct address
|
0 comments :
Post a Comment