Residence Class
The constructor takes an integer for the number of rooms, an integer for the number of external walls, and a boolean to indicate whether or not there is a washer.
Residence also has four methods:
- HasWasher(), which returns a boolean. It returns true if there is a washer in the residence and false otherwise. This method should be protected.
- PropertyValue(), which returns a double. It calculates the property value based on number of rooms * 10000.
- NumWindows(), which returns an int. It calculates the number of windows based on the number of external walls * 2.
- operator<<, which returns an ostream& containing the number of rooms, the number of walls, whether or not there is a washer, the number of windows, and the property value. This will be a friend function, so it is not inherited.
The output of operator<< should be similar to the following.
Number of Rooms: 4 Number of Walls: 4 Washer: true Number of Windows: 8 Property Value: 40000.0
As a reminder, public members and methods are accessible from any class, while private members and methods are only accessible from within the class in which they are declared. The protected provides protection midway between public and private. Only classes inherit from a class with protected items may access those items directly.