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; } Why isn't constructor getting called?
cout << "My Text" << endl;). This works better in terminals that don't automatically insert a new line after program execution. Back to the question: what compiler are you using and I assume you have included<iostream>?<iostream.h>and<conio.h>? Can you make a minimal example in standard C++?