Question: 1.(Array of Objects, Friend Functions and Classes, 60 points) write the definitions for the constructors in the following class. And write prototypes and definitions for

1.(Array of Objects, Friend Functions and Classes, 60 points) write the definitions for the constructors in the following class. And write prototypes and definitions for the accessor and mutator functions to access and mutate the data members (6 functions).

class Building {

string address; // ex Park Ave

int No_floors;

double area;

Building(); // assign values for address, No_floors, and area.

Building(string, int,double);

Building(string, int);

Building(double,string, int);

2.Change the definition of the default constructor to allocate an array of 3 integers dynamically in addition to the previous job of assigning values for the data members.

3.Add a destructor for this class, the destructor should release the memory that was allocated dynamically by the constructor.

4.In the main function, declare an array of 5 objects of type Building and initialize these objects using different constructors.

5.For each object in the previous step call the accessor and mutator functions to set and get the values of the data members.

6.Change class Building to have a friend function which has the following prototype

Building getBuildingArea(Building*);

7.In the main function declare an object of type Building, pass this object to getBuildingArea function, which should return an object of type

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!