+ 15

What these destructor means??[SOLVED]

What is meant by declared virtual and pure virtual destructors in c++??

31st Aug 2021, 6:37 AM
🔰Saurabh🔰
🔰Saurabh🔰 - avatar
9 ответов
+ 7
Pure virtual destructors are legal in standard C++ and one of the most important things to remember is that if a class contains a pure virtual destructor, it must provide a function body for the pure virtual destructor. 
31st Aug 2021, 6:54 AM
JTB Coder
JTB Coder - avatar
+ 3
JTB Coder what about declared virtual destructor??
31st Aug 2021, 6:57 AM
🔰Saurabh🔰
🔰Saurabh🔰 - avatar
+ 2
🔰 THIEA 🔰 Deleting a derived class object using a pointer of base class type that has a non-virtual destructor results in undefined behavior. To correct this situation, the base class should be defined with a virtual destructor.
1st Sep 2021, 7:29 AM
JTB Coder
JTB Coder - avatar
+ 1
Pure destructor This means that a derived class' destructor will be invoked first, then base class destructor will be called. ~Virtual destructor~ is used to free up the memory space allocated by the derived class object or instance while deleting instances of the derived class using a base class pointer object.
31st Aug 2021, 8:38 AM
Shiv Tiwari
Shiv Tiwari - avatar
+ 1
Destructor is a function that is executed automatically when an object is destroyed that has been created by the constructor.
31st Aug 2021, 9:38 AM
Shiv Tiwari
Shiv Tiwari - avatar
- 2
Can apps subscription
2nd Sep 2021, 5:23 AM
SM Hussain
- 2
Cencel supscription
2nd Sep 2021, 5:29 AM
SM Hussain