Inheritance
A new class can be defined based on an old class. All the data and associated methods becomes part of the new class.
class pen {
int x, y;
int status;
public:
void set_status(int);
void set_location(int, int);
};
class colored_pen: public pen {
int color;
public:
void set_color(int);
};
Previous slide
Next slide
Back to first slide
View graphic version