Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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 assignment

Explanation / 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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote