Topic: Stack objects destructed in order?


Author: Shapiro@AOL.com (Eric Shapiro)
Date: Thu, 09 Feb 1995 22:47:07 -0500
Raw View
If I have 2 stack-based objects in a function, does the C++ standard
guarantee that the destructors are called in the reverse order of the
object creation?

Example:
void MyFunc( void )
{
   CClass1  a;   // a stack object
   CClass2  b;   // another stack object

  // is b's destructor called before a's?
}

Please respond via eMail as well -- I don't get by these parts too often.

 Thanks!
 Eric Shapiro
 Rock Ridge Enterprises
 Shapiro@aol.com