Hi guys,

If am cretating a QObject 's object in a stack , will it call the distructor after the "AUTO" scope..

see the below code...
Qt Code:
  1. class MyClass : QObject
  2. {
  3. public :
  4.  
  5. MyClass( const QString & name )
  6. :_name( name ),QObject( )
  7. {
  8.  
  9. cout<<"\n MyClass() ...";
  10. }
  11. ~ MyClass()
  12. {
  13. cout<<__FUNCTION__ ;
  14. }
  15.  
  16. private:
  17. QString _name;
  18.  
  19. };
  20.  
  21. int main( int argc, char *argv[] )
  22. {
  23. QApplication a(argc, argv);
  24.  
  25. MyClass obj
  26. qDebug()<<"Hello Qt 4.2.2 ";
  27.  
  28.  
  29. a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
  30. return a.exec();
  31.  
  32. }
To copy to clipboard, switch view to plain text mode 

In this code ( obj in stack ) , ~MyClass() is not getting called.
But if i am creating the "obj " in heap and "delete obj" will call the ~MyClass..

Could you please tell me why this distructor is not getting called while object is created in stack...???