I did practicals on Destructor but when compile this program I don't know why the output not come as I thought.
#include <iostream>
using namespace std;
class aaa
{
   private:
   static int x;
   int code;
   public:
   /*after constructor executes 3 times the value of "code" becomes 103*/
  aaa()   
  {
    code=x;
    cout<<"Default Constructor"<<endl;
    x++;
  } 
  ~aaa() 
  {
    cout<<"Destructor of "<<code<<endl;
  } 
};
int aaa::x=101;
int main() 
{
   aaa *p;
   p=new aaa[3];
   delete []p;
   return 0;
 } 
Output is:
Default Constructor
Default Constructor
Default Constructor
Destructor of 103
Destructor of 102 
Destructor of 101
while I thought it was going to be this:
101
102
103