+ 6
What are the constructors and destructors in C++??
🏵🌼💐🌸💮🏵💐🌸🌼
3 ответов
+ 9
Nithya Yamasinghe posting in your feed was a nice idea to reach many users to get a quick response👍
from tutorialspoint :
https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm
https://www.sololearn.com/learn/CPlusPlus/1715/?ref=app
https://www.sololearn.com/learn/CPlusPlus/1875/?ref=app
https://www.sololearn.com/Discuss/1108801/?ref=app
https://www.sololearn.com/Discuss/1182679/?ref=app
+ 7
Constructors allocate memory for objects and initialize them. Destructors free the memory and other resources.
+ 4
Constructors do not allocate memory for objects (that's done with 'new'). They are used to initialize an object (instance of a class) with an valid state.