Introduction to OOP | Chapter 24: Design Patterns : | next | previous | audio | real | text |
class Triangle : public Shape { public: Triangle (Point, Point, Point); // ... virtual void displayOnPrinter (Printer); virtual void displayOnTerminal (Terminal); // ... private: Point p1, p2, p3; }; void Triangle.displayOnPrinter (Printer p) { // printer-specific code to // display triangle // ... } void Triangle.displayOnTerminal (Terminal t) { // terminal-specific code to // display triangle // ... }