When inheriting classes in C++ I understand members are inherited. But how does one inherit the methods as well?
For example, in the below code, I'd like the method "getValues" to be accessible not through just CPoly, but also by any class that inherits it. So one can call "getValues" on CRect directly.
class CPoly {
private:
int width, height;
public:
void getValues (int* a, int* b)
{ *a=width; *b=height;}
};
class CRect: public CPoly {
public:
int area ()
{ return (width * height); }
};
In other words, is there any way to inherit methods for simple generic methods like getters and setters?