## 21.3 Virtual and Nonvirtual Overriding (cont.)

- One `operator<<`, takes a reference to a base class
- Uses a reference selector to call the virtual print method:

  > `Employee* emp = new Employee("Fred Jones", 67000);
  > cout << emp << "\n";`

  prints: `Employee Fred Jones.`

  > `emp = new Manager("Sarah Smith", 82000);
  > cout << emp << "\n";`

  prints: `Manager Sarah Smith.`

prev |top |next