The class Chimney represents a smoke ventilation system.
Each instance of a Chimney has a height, a shape and can be either opened or closed.
Based on this implementation of Chimney, define and implement the class Fireplace (a .h file and a .cpp
file). A Fireplace can be lit or extinguished and always has a Chimney to ventilate the smoke away.
Make sure your definition of Fireplace supports the following kinds of constructors:
By default, a lighted fireplace with an open chimneystack that has a height 10 feet.
Fireplace warmFire;
An unlit fireplace with a closed chimneystack that has a height of 20 feet
Fireplace noFire( 20, false );
In addition, create these two operations on Fireplace :
These operations should adjust the Fireplace by manipulating the Chimney, opening the chimneystack
before the Fireplace’s fire is lit and closing the chimneystack after the fire is extinguished.
As currently defined, can any of the member operations you defined on the class Fireplace be marked const?
How can I manipulate the Chimney class variables inside the FirePlace class implementation?
I am not even sure if I have to inherit something from Chimney class, is it possible for those two class to work together without inheriting from each other?
> A Fireplace can be lit or extinguished and always has a Chimney to ventilate the smoke away. has suggest composition
1 2 3
class Fireplace{
Chimney meaningful_name;
};
> is it possible for those two class to work together
¿do you understand the difference between an object and a class?
¿do you realize that you can have several chimneys?
You may communicate with an object that you:
1) receive it as a parameter in the method void Match::Fire( Paper &important_document )
a) own an instance or have a reference
1 2 3 4 5 6
class Car{
Human *driver;
void crash(){
this->driver->die();
}
};
alpha) create it
1 2 3 4
class Programmer::Foo(){
Weapon gun;
gun.shoot( this->right_foot );
}
> VS tells me that I can't acces isitOpen
you took the time to code an interface, use it