Posted On: Feb 22, 2018
Constructor | Destructor |
A constructor is used to initialize the instance of a class or object. | A destructor simply destroys the objects when they are no longer needed. |
A constructor is called when a new instance of a class or object is created. | A destructor is called when an instance of a class or object is deleted or released. |
A constructor allocates the memory. | A destructor releases or frees the memory. |
Constructors can have arguments. | A destructor cannot have any arguments. |
Overloading of the constructor is possible in C++. | Overloading of destructors is not possible. |
A constructor has the same name as class name. | A destructor also has the same name as class name but with (~) tiled operator. |
Never Miss an Articles from us.
Object-oriented programming (OOP) is a type of computer programming, also more commonly known as software design, in wh..
The statement #include is used in C++ to include the source file or import the header files containing definitions of f..
The ‘this’ pointer is passed as a hidden argument to all the non-static member method calls and is available as a l..