// main2.cc // In this version the class Account is declared in file Account.h // and the methods are in file Account.cc which is compiled separately // g++ -c Account.cc -c means compile only giving Account.o // g++ main2.cc Account.o compile & link // a.out run it // #include "Account.h" main () { Account mine, yours (100); // allocates 2 Account objects and initializes each with "c-tor" // The second account is initialized with a balance of 100 - first 0. mine.deposit (500); // now balance should be 500 mine.status (); // "The balance is : 500" yours.status (); // "The balance is : 100" yours.deposit (300); yours.status (); // "The balance is : 400" mine.withdraw (600); // now in the red mine.status (); // "The balance is : -100" } //2 accounts are destructed here