home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / bcpp / file19 / tstmain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  858 b   |  25 lines

  1. /////////////////////////////////////////////////////////////////////
  2. // Main program used for testing shape construction and destruction
  3. // Copyright(c) 1993 Azarona Software.
  4. /////////////////////////////////////////////////////////////////////
  5.  
  6. main()
  7. {
  8.   // Record how many global Shapes were constructed
  9.   int global_objects = Shape::objects_needing_destruction;
  10.   test();
  11.   // Check that ctor/dtor calls balance out
  12.   if (Shape::objects_needing_destruction == global_objects) {
  13.      cout << "\nConstructors and destructors balance.\n";
  14.   }
  15.   else {
  16.      cout << "\nConstructors/destructors out of balance.\n"
  17.           << "Number of objects left undestructed: "
  18.           << Shape::objects_needing_destruction << '\n';
  19.   }
  20.   cout << "Should be " << global_objects 
  21.        << " global objects left to destroy:\n";
  22.   return 0;
  23. }
  24.  
  25.