sources:
CashOffice.cpp (2.5k)
CashOffice.h (1.6k)
O1_3.cpp (1.2k)
PrimitiveTypes.h (421 bytes)
Room.cpp (1.8k)
Room.h (1.4k)


website:
more info here
studies/bauelemente/Softwarebauelemente-CodeO1-3/O1_3.cpp
download file

  1 ///////////////////////////////////////////////////////////
  2 // Softwarebauelemente I, Aufgabe O1.3
  3 //
  4 // author: Stephan Brumme
  5 // last changes: January 15, 2001
  6
  7
  8 #include "CashOffice.h"
  9 #include <iostream>
 10
 11
 12 using namespace std;
 13
 14
 15 void main()
 16 {
 17     CCashOffice myCashOffice(2,3,7);
 18     CCashOffice myCashOffice2(4,5,42);
 19
 20     myCashOffice.Show();
 21     myCashOffice2.Show();
 22
 23     // I wrote some lines twice to verify the overloaded operators
 24
 25     cout<<"Compare cashoffices ... "<<(myCashOffice==myCashOffice2)<<endl;
 26 // cout<<"Compare cashoffices ... "<<myCashOffice.EqualValue(myCashOffice2)<<endl;
 27
 28     cout<<"Now copy myCashOffice to myCashOffice2 ..."<<endl;
 29     myCashOffice2 = myCashOffice;
 30 // myCashOffice2.Copy(myCashOffice);
 31
 32     cout<<"Compare again ... "<<(myCashOffice==myCashOffice2)<<endl;
 33 // cout<<"Compare again ... "<<myCashOffice.EqualValue(myCashOffice2)<<endl;
 34
 35 // next line will throw a compilation error due to private inheritance
 36 // cout<<myCashOffice.GetArea()<<endl;
 37
 38 // but the new method works well
 39     cout<<"cashoffice 1 covers "<<myCashOffice.GetAreaOfCashOffice()<<" acres"<<endl;
 40
 41     cout<<"Verify the Copy-To-Itself protection ..."<<myCashOffice.Copy(myCashOffice)<<endl;
 42 }
 43