PPT Slide
Because the specific implementation of the behavior will be different for each fruit, make the description of this function into a pure virtual method.
Using a template method, create a fruit adaptor that will take either an apple or an orange, and satisfy the fruit interface:template <class T>class FruitAdaptor : public Fruit { public: FruitAdaptor (T & f) : theFruit(f) { } T & value () { return theFruit; } virtual void print (ostream & out) { print(theFruit, out); } public: T & theFruit;};