1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Juliette [100K]
3 years ago
15

Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class Win

dowWithBorder 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.
Computers and Technology
1 answer:
Pepsi [2]3 years ago
5 0

Answer:

Following are the code in the C++ Programming Language.

//define class and inherited the parent class

class WindowWithBorder : public Window

{

//access modifier

private:

//set integer variable

int borderWidth;

//set integer variable

int windowWidth;

//access modifier

public:

//definition of the constructor that accept an integer type argument

WindowWithBorder(int);

//definition of the function

int getUseableWidth();

};

//set constructor outside the class

WindowWithBorder::WindowWithBorder(int y)

{

//initialization in integer variable from function

windowWidth = getWidth();

//initialization in integer variable from the argument list

borderWidth = y;

}

//set function from outside the class

int WindowWithBorder::getUseableWidth()

{

//return output

return windowWidth - borderWidth;

}

Explanation:

Here we define a class "WindowWithBorder" which inherit their parent class "Window", inside the class.

  • Set two integer data type private variables "borderWidth" and "windowWidth".
  • Write the definition of the "windowWidth" class constructor that accept the integer type argument list.
  • Write the definition of the function "getUseableWidth()" which is integer type.

Then, we define constructor outside the class which accept the integer type argument list "y" inside it.

  • we initialize in the variable "windowWidth" from the function "getWidth()".
  • Initialize in the variable "borderWidth" from the argument of the constructor.

Finally, we define function in which we perform the subtraction of the variable "windowWidth" from the variable "borderWidth" and return it.

You might be interested in
The MIQ inventory measures how much you value status. Which two measures are measures of status?
Alika [10]
It would be the social standing of a person and the economic standing of a person. 
6 0
3 years ago
What keyboard combination can you use to open the windows tool context menu, which contains options such as power options and di
Shkiper50 [21]
Windows button and x
8 0
3 years ago
What is a risk or an effect of software piracy?
Butoxors [25]
Piracy is a term used to describe the practice of obtaining or using software in a manner that is illegal or not in keeping with the terms under which the software was distributed. This can range from purchasing or copying the software, to using the software without a license, to selling, renting, or otherwise distributing it without authorization.<span>The Business Software Alliance estimated the losses to software companies in 2005 as a result of piracy at over $30 billion.</span>
5 0
3 years ago
Read 2 more answers
Sharon is thinking about opening a bakery. She knows she wants to set her own hours, reduce her stress and make a profit. But sh
kondaur [170]
C would not be a beginner move.

hope it helps
6 0
3 years ago
An abstraction is a simplified representation of something that is more complex. Decimal numbers were a useful abstraction in th
Blababa [14]

What was the content of the lesson? It is hard to answer a question we need context on.

6 0
3 years ago
Other questions:
  • You can use Facebook's live feed tool to broadcast content as you post it
    8·2 answers
  • Your friend is working on fixing their Homework assignment. They need a lot of help. You know all the bugs in the file, but due
    12·1 answer
  • If you place a semicolon after the test expression in a while loop, it is assumed to be a(n) ________. a. pre-test loop b. post-
    9·1 answer
  • 1) In your own words, explain what a browser is. 2) Why is it important to keep your browser up to date?
    12·1 answer
  • ListenListen with ReadSpeakerAn administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on
    9·1 answer
  • ____ steganography places data from the secret file into the host file without displaying the secret data when you view the host
    9·1 answer
  • A database administrator (DBA) must have a clear understanding of the fundamental business of an organization, be proficient in
    12·1 answer
  • The construction of a mixed media assemblage would be considered
    9·1 answer
  • Complete the statement below using the correct term.<br>Website managers use<br>every day​
    11·2 answers
  • The development of online capabilities created the ________, an information- and communication-based electronic exchange environ
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!