int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); // Create objects of type CheckingAccount and SavingsAccount. CheckingAccount *pChecking = new CheckingAccount( 100.00 ) ; SavingsAccount *pSavings = new SavingsAccount( 1000.00 ); // Call PrintBalance using a pointer to Account. Account *pAccount = pChecking; pAccount->PrintBalance(); // Call PrintBalance using a pointer to Account. pAccount = pSavings; pAccount->PrintBalance(); cout << "\n--------------------------------------------------------------------------------\n"; //-------------------------------------------------------------------------------- // Declare an object of type Derived. Derived aDerived; // Declare two pointers, one of type Derived * and the other // of type Base *, and initialize them to point to aDerived. Derived *pDerived = &aDerived; Base *pBase = &aDerived; // Call the functions. pBase->NameOf(); // Call virtual function. pBase->InvokingClass(); // Call nonvirtual function. pDerived->NameOf(); // Call virtual function. pDerived->InvokingClass(); // Call nonvirtual function. return a.exec(); }