Constructor and destructor ppt
Constructor
A class constructor is a special member function of a class that is executed whenever we create new objects of that class.
A constructor will have exact same name as the class and it does not have any return type at all, not even void. Constructors
can be very useful for setting initial values for certain member variables.
Constructor destructor c++ , copy constructor in c++
Destructor
The Class Destructor
A destructor is a special member function of a class that is executed whenever an object of it's class goes out of scope or whenever the
delete expression is applied to a pointer to the object of that class.
constructor destructor c++ , copy constructor in c++ , ,difference between constructor and destructor in c++
A destructor will have exact same name as the class prefixed with a tilde (~) and it can neither return a value nor can it take any parameters.
Destructor can be very useful for releasing resources before coming out of the program like closing files, releasing memories etc.
0 comments:
Post a Comment