Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The most effective way to avoid slicing of objects is to ensure, whenever possible, that polymorphic base classes are abstract.

Code Block
bgColor#FFCCCC#ccccff
class Employee {
public:
  Employee(string theName) : name(theName) {};
  virtual ~Employee();
  string getName() const {return name;}
  virtual void print() const = 0;
private:
  string name;
};

...