what is consructor and destructor in c++?
Answers
Answered by
1
The destructor is called automatically by the compiler when the object goes out of scope. The syntax for destructor is same as that for the constructor, the class name is used for the name of destructor, with a tilde ~ sign as prefix to it. class A { public: ~A(); }; Destructors will never have any arguments.
Answered by
0
The destructor is called automatically by the compiler when the object goes out of scope. The syntax for destructor is same as that for the constructor, the class name is used for the name of destructor, with a tilde ~ sign as prefix to it. class A { public: ~A(); }; Destructors will never have any argument.
Similar questions