Introduction to OOP | Chapter 14: Polymorphism and Software Reuse: | next | previous | audio | real | text |
Only need specify what is new - the addition method. Everything else is given for free.
class Set : public List { public: void add(int); }; void Set::add(int x) { if (! includes(x)) // only include if not already there List::add(x); }