by Dinesh Thakur Category: Classes in C++

In the Inheritance when we Points or Pass the Reference of Second Class Object into the Pointer Object of First Class , then the Pointer object of first class will call only the Constructor of Sub Class But Destructors are not Called With the help of Base Class Pointer Object. Because the Statements or Destructors of Base Class are never Override.

 

So When we wants to call the Destructor of Sub Class With the help of First Class Pointer Object then we use the Virtual Destructors When we use the Virtual Destructors then the Body of the Base Class Destructors will automatically Override.

 

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article