Hi, i made this program that does nothing to see when the constructor and destructor are called. I have a question, shouldnt the contructor and destructor have been called 3 times each instead of just two.....can you explain this to me please. Here is my code:-
Code:#include<iostream> using namespace std; class lets { public: lets(); virtual ~lets(); char *t; }; lets::lets() { cout<<"called constructor"<<endl; } lets::~lets() { cout<<"called destructor"<<endl; } int main() { lets y; lets k; y.t=new char; delete y.t; { k.t=new char; delete k.t; } return 0; }