Abstract base class representing a generic building. More...
#include <Buildings.h>
Public Member Functions | |
| Building (std::string name, int numRooms, int m_squared, float value, std::string type) | |
| Constructor to initialize a Building object. | |
| virtual | ~Building () |
| Virtual destructor for the Building class. | |
| std::vector< Citizen * > | getCitizens () const |
| Gets the list of citizens in the building. | |
| virtual void | build ()=0 |
| Pure virtual function to build the building. | |
| virtual Building * | clone ()=0 |
| Pure virtual function to clone the building object. | |
| virtual void | displayCitizens () |
| Displays the list of citizens in the building. | |
| virtual void | addCitizen (Citizen *human)=0 |
| Pure virtual function to add a citizen to the building. | |
| virtual int | getLeftOverCapacity ()=0 |
| Pure virtual function to get the leftover capacity of the building. | |
| virtual std::string | getType () const =0 |
| Pure virtual function to get the type of the building. | |
| std::string | getName () |
| Gets the name of the building. | |
| std::string | getBuildingType () |
| Gets the building's type description. | |
| bool | getBuilt () const |
| Checks if the building is built. | |
| void | renovate () |
| Renovates the building, updating any necessary properties. | |
Protected Attributes | |
| std::string | name |
| Name of the building. | |
| std::string | type |
| Type of the building (e.g., Residential, Commercial) | |
| int | numRooms |
| Number of rooms in the building. | |
| int | m_squared |
| Area of the building in square meters. | |
| float | value |
| Value of the building. | |
| bool | built = false |
| Flag indicating if the building is built. | |
| Budget * | budget |
| Pointer to a Budget object for managing building finances. | |
| Concrete * | concrete |
| Pointer to a Concrete object for building materials. | |
| Steel * | steel |
| Pointer to a Steel object for building materials. | |
| Wood * | wood |
| Pointer to a Wood object for building materials. | |
| std::vector< Citizen * > | citizens |
| List of citizens associated with the building. | |
Abstract base class representing a generic building.
The Building class serves as a base class for various types of buildings (e.g., Residential, Commercial). It includes essential attributes such as name, type, number of rooms, area, value, and lists of citizens. Derived classes must implement the pure virtual functions to define specific behaviors.
| Building::Building | ( | std::string | name, |
| int | numRooms, | ||
| int | m_squared, | ||
| float | value, | ||
| std::string | type ) |
Constructor to initialize a Building object.
| name | Name of the building. |
| numRooms | Number of rooms in the building. |
| m_squared | Area of the building in square meters. |
| value | Value of the building. |
| type | Type of the building. |
|
pure virtual |
Pure virtual function to add a citizen to the building.
| human | Pointer to the Citizen to be added. |
Derived classes must implement this function to handle adding citizens.
Implemented in Commercial, Industrial, Instatutional, and Residential.
|
pure virtual |
Pure virtual function to build the building.
Must be implemented by derived classes to define specific building construction behavior.
Implemented in Apartment, Commercial, Factory, GovernmentBuilding, Hospital, House, Industrial, Instatutional, Mall, Mansion, Office, Plant, Residential, School, Shop, and Warehouse.
|
pure virtual |
Pure virtual function to clone the building object.
Implemented in Apartment, Commercial, Factory, GovernmentBuilding, Hospital, House, Industrial, Instatutional, Mall, Mansion, Office, Plant, Residential, School, Shop, and Warehouse.
|
virtual |
Displays the list of citizens in the building.
This function can be overridden by derived classes to provide specific display behavior.
Reimplemented in Commercial, Industrial, Instatutional, and Residential.
| std::string Building::getBuildingType | ( | ) |
Gets the building's type description.
|
inline |
Checks if the building is built.
|
inline |
Gets the list of citizens in the building.
|
pure virtual |
Pure virtual function to get the leftover capacity of the building.
Derived classes must implement this function to define capacity limits.
Implemented in Commercial, Industrial, Instatutional, and Residential.
| std::string Building::getName | ( | ) |
Gets the name of the building.
|
pure virtual |
Pure virtual function to get the type of the building.
Implemented in Apartment, Commercial, Factory, GovernmentBuilding, Hospital, House, Industrial, Instatutional, Mall, Mansion, Office, Plant, Residential, School, Shop, and Warehouse.
| void Building::renovate | ( | ) |
Renovates the building, updating any necessary properties.
This function can be overridden by derived classes to provide specific renovation behaviors.