previous | start | next

The main Function

int main()
{
  Employee *p;
 
  p = new Employee("Bob", 45000.00);
  cout << p->getBonus() << endl;
  // Prints: 450  (using Employee's getBonus())

  p = new Manager("Alex", 60000.00);  // p now points to a Manager value

  cout << p->getBouns() << endl;
  // Prints: 120000  
  // (uses getBonus from Manager's virtual function table) 


previous | start | next