class Polygon {
protected:
int width, height;
public:
void set_values (int a, int b)
{ width=a; height=b; }
};
class Rectangle: public Polygon {
public:
int area()
{ return width*height; }
};
int main () {
Rectangle rect;
Polygon * ppoly1 = ▭
ppoly1->set_values (4,5);
cout << rect.area() << '\n';
return 0;
}
In above example, what does ppoly1 points to and how is this pointer not able to access rectangle class's function?
WHY ppoly1->area() is an error
Thanks!