Code
#include<iostream>
struct A
{
~A()
{
std::cout<<"dctorA\n";
}
};
struct B: public A
{
~B()
{
std::cout<<"dctorB\n";
}
};
int main()
{
B b1;
b1.~A();
}
Output
dctorA
dctorB
dctorA
if destructor is not inheriting then how I am able to call it through object of B ?
and I know Rule of three and five but compiler work in spit of rule followed or not. so to avoid complexity I avoided writing copy constructor and overloaded= operator.