## 21.6 Slicing and Polymorphism

- Layout of objects on the stack is determined at compile time
- C++ used different rules for pointers than for objects
- Only pointers (and references) are truly polymorphic:

  >     Employee e("Lisa Lim", 36000);
  >     Manager m("Sarah Smith", 67000, 2000);
  >     e = m; // Permitted, but manager fields sliced away
  >     cout << e.annual_income() << "\n";
  >        // Uses Employee member function

prev |top |next