Why are the destructors not called?
Even though I've written destructors for class A and B, it's not being called.
#include<iostream.h> #include<conio.h> class A { public : A() { cout<<"\nIn A const."; } ~A() { cout<<"\nIn A dest."; } }; class B : public A { public : B() { cout<<"\nIn B const."; } ~B() { cout<<"\nIn B dest."; } }; int main() { A a; B b; getch(); return 0; } I've given the actual code above. Removing the following statements perfectly shows the calling of destrutors.
int main() { A a; B b; } Why isn't constructor getting called?