Computer Science, asked by Mallika1999, 1 year ago

what is consructor and destructor in c++?

Answers

Answered by NirmalNiraj
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 oopspc
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