1.

Differentiate between Constructor and Destructor function with respect to Object Oriented Programming.

Answer»
Constructor Destructor
Constructor is used to initialize the object.Destructor is used to destroy the objects that are created in memory previously.
Constructor can takes arguments.Destructor cannot take any arguments.
Constructor overloading can be possible means more than one constructor can be defined in same class.Destructor overloading cannot be possible.
Syntax of constructor :
class class_name
{
class_sname() {}
class_name(argulist){}
} ;
Syntax of destructor: class class_name
{
 ~class-name(void){}
};


Discussion

No Comment Found

Related InterviewSolutions