Question: In C++ programming language Create the header file Shape.h. In the header file define the interface Shape that has A double constant method named Perimeter()
In C++ programming language
Create the header file Shape.h.
In the header file define the interface Shape that has A double constant method named Perimeter() that takes no parameters.
A double constant method named Area() that takes no parameters.
And the class Square that publicly inherits Shape and has components Private double field named side.
Public default constructor. It assigns 1 to side.
Public overloaded constructor that takes one double parameter. It assigns the parameter to side if the parameter is positive; otherwise, it assigns 1 to side.
Public copy constructor.
Public assignment operator.
Public empty destructor.
Public constant get method for side.
Public set method for side. It assigns the parameter to side only if the parameter is positive; otherwise, it does nothing.
Public overridden Perimeter() method. It returns the perimeter of the square.
Public overridden Area() method. It returns the area of the square.
Public string constant method named ToString() that takes no parameters. It returns a string of side enclosed in parentheses.
Overloaded ostream operator. It outputs the same as ToString().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
