No, a constructor is not called when you create a class. It's created when you create an OBJECT. And a destructor is called whenever you DESTROY that object. Whether you use the delete keyword to delete an object, or the program ends, the object will be destroyed, and the destructor will be executed.
Code:
#include <iostream>
using namespace std;
class Doggy
{
public:
Doggy(){cout<<"Object created." <<endl;}
~Doggy(){cout<<"Objected destroyed."<<endl;}
};
int main(void){
Doggy *Max = new Doggy;
delete Max;
cin.get();
return 0;
}
So if you never create an object of your class, you can't destroy it can you? Neither the constructor, not the destructor will be executed. Just having the class there won't call either of them.