28 lines
725 B
C++
28 lines
725 B
C++
#ifndef EXAMPLE11_HOUSE_H
|
|
#define EXAMPLE11_HOUSE_H
|
|
|
|
#include <iostream>
|
|
#include "Room.h"
|
|
|
|
class House {
|
|
private:
|
|
std::string name;
|
|
Room kitchen, livingRoom, bedroom; //composition
|
|
public:
|
|
House(std::string name) : name(name), kitchen("Kitchen1"), livingRoom("living room 1"),
|
|
bedroom("TV bedroom") {
|
|
std::cout << "House::constructor" << std::endl;
|
|
}
|
|
virtual ~House() {
|
|
std::cout << "House::destructor" << std::endl;
|
|
}
|
|
virtual void print() const {
|
|
std::cout << "House name: " << name << std::endl;
|
|
kitchen.print();
|
|
livingRoom.print();
|
|
bedroom.print();
|
|
}
|
|
};
|
|
|
|
#endif //EXAMPLE11_HOUSE_H
|