Give the
difference between C & C++.
C
|
C++
|
1. Procedure oriented language
|
1. Object oriented language
|
2. Standard library include is <stdio.h>
|
2. Standard library include is <iostream.h>
|
3. Scanf and printf are used for input and output
operation.
|
3. cin and cout are used for input and output operation.
|
4. Data is not secured.
|
4. Data is secured.
|
5. Programs are divided into smaller parts called function.
|
5. Programs are divided into what are known as objects.
|
Give difference
between Constructor & Destructor.
Constructor
|
Destructor
|
1. Constructor is special member function use to
initialize objects.
|
1. Destructor is also special member functions use of
to release dynamic allocated memory.
|
2. class rectangle { // A simple class int height; int width; public: rectangle(void); // with a constuctor, }; |
2. . class rectangle { // A simple class int height; int width; public: ~rectangle(void); // and a destructor
};
|
3. Constructor can be overloaded. |
3. Destructor can
not be overloaded.
|
4. Constructor can not be virtual.
|
4. Destructor can
be virtual.
|
5.Constructor can have return value
|
5.Destructor cannot have return value
|