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

1. (TCO 2) Consider the following class definition. class rectangleType { public

ID: 3672039 • Letter: 1

Question

1. (TCO 2) Consider the following class definition.

class rectangleType
{
public:
     void setLengthWidth(double x, double y);
     //Postcondition: length = x; width = y;
     void print() const;
     //Output length and width;
     double area();
     //Calculate and return the area of the rectangle;
     double perimeter();
     //Calculate and return the parameter;
     rectangleType();
     //Postcondition: length = 0; width = 0;
     rectangleType(double x, double y);
     //Postcondition: length = x; width = y;
private:
     double length;
     double width;
};

Which of the following class-variable declarations is correct? (Points : 4)        rectangle rectangleType;
       class rectangleType rectangle;
       rectangleType rectangle;
       rectangle rectangleType.area;

Explanation / Answer

Please find the answers below :

1) rectangleType rectangle;

2) image not loading

3) the member variables can be either public or private

4)  objects of another class type

5) The ClassB object may access them just like its own private data members.

6) ClassB objectB[10];

7)   "has a"

8) can specify a call to the constructor of a base class in the body of the constructor function definition

9) BClass constructor first, AClass constructor second

10) Mother and Father to Children