Hello i need help creting a class using an accessor funciton and a mutator function.
i have to desing a general C++ class that will be used to represent "Building" objects, and meets the following criteria:
- each building object has a number of rooms(integer value)
- each Building object has a number of floors(integer value)
- each building object has a floor area(integer value)
- each building aobject has a heating type (*char value). the type of heating used is either electric(value=e) or oil(value =o).
all data members i include must be private, must be accessed oly by a public member function and each datamember must have an accessor function to retreive the current value and a mutator function to assign a new value.
ckass definition has to include botha constructor (initial values of integer data members should be zero and character values should = e) and a destructor function. the destructor shold display a message to the screen that the object has been destroyed. also an overloaded constructor must be created for th 'building' object.
And here is what i have done sofar.. I am a newbie, and at this point i feel lost.. i am learning from the deital and deital how to learn C++, and my instructors arent much help, so at this point i dont know what to do. I had 2 weeks to get familier with C and learn C++. so im stressed
// declaration of building class
//prevent multiple inclusions of header file
//building data type definition
building(int =0, int=0, int=0, char=e); //Constructor
can anyone help.. pleae.. i dont know how to implement accessor and mutator functions. and how to overload a constructor.