именно здесь я определил класс окна и производный класс, я только начал работать с наследованием, и я пытаюсь проработать этот пример из класса, и любая ссылка на то, где я могу легче изучить наследование, будет полезна, а также поможет с этим конкретным вопрос! Пытаясь проработать это, ребята
//Window class
class Window{
private:
int width;
public:
int getwidth(){
int width;
cin>>width;
return width;
};
};
подкласс окна
//subclass
class WindowWithBorder:public Window{
private:
int BorderWidth;
public:
//constructor that accepts an integer parameter which is used to initialize the instance variable
WindowWithBorder(int);
int GetUseableWidth(int x,int y){
//return width of window minus the width of the border
int UseableWidth;
UseableWidth=x-y;
return UseableWidth;
};
};
int main(){
//1.
//2.
Window obj1;
int useablewidth;
int width,borderwidth;
cout<<"Enter a width: ";
width=obj1.getwidth();
Вот где у меня проблема .........
borderwidth=obj1.WindowWithBorder(4);
//useablewidth=GetUseableWidth(width,BorderWidth);
//cout<<endl;
//cout<<"The useable width is: "<<useablewidth;
return 0;
};