Anonymous
public cpp v1 · immutable#include <iostream>using namespace std;class CPolygon { protected: int width, height; public: void set_values (int a, int b) { width=a; height=b;} };class CRectangle: public CPolygon { public: CRectangle() : width(3) {} int area () { return (width * height); } };Compile error:$ g++ poly.cpp poly.cpp: In constructor ‘CRectangle::CRectangle()’:poly.cpp:15: error: class ‘CRectangle’ does not have any field named ‘width’