Assume the existence of a Window class with a function getWidth that returns the
ID: 3658784 • Letter: A
Question
Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class WindowWithBorder that contains a single additional integer instance variable named borderWidth, and has a constructor that accepts an integer parameter which is used to initialize the instance variable. There is also a function getUseableWidth, that returns the width of the window minus the width of the border. i need to do it without using "this" function this is for myprogramminglab assignmentExplanation / Answer
class WindowWithBorder : public Window
{
public:
WindowWithBorder();
WindowWithBorder(int);
int getUseableWidth();
private:
int borderWidth;
};
WindowWithBorder::WindowWithBorder()
{
borderWidth = 0;
}
WindowWithBorder::WindowWithBorder(int a)
{
borderWidth = a;
}
int WindowWithBorder::getUseableWidth()
{
return getWidth()-borderWidth;
}
assuming like the module said the getWidth class is defined in the base class.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.