The state of the room should not depend on the amount of furniture in it, so the room should not consist of furniture, but let it consist of windows and doors, walls and ceilings ... Therefore, let it have Furniture * pf, and when I want to remove it from the room furniture, it will be easy, i.e. pf = 0. There is no furniture, but there is a room ...
using std::string; class Furniture { string chair, sofa, cupboard; // ... }; class Room { Furniture* pf; //... public: Room(Furniture* havings = 0) : pf(havings) {} //... ~Roome() { delete pf; } Roome& remove furniture() { if(pf) pf = 0; return *this; } // убрать Roome& add_furniture() { ...... } // добавить void show_furniture() const { std::cout << pf->chair <<'\n' <<pf->sofa <<'\n' << pf->cupboard <<'\n';} };
and when you destroy a room, the furniture in it will be destroyed ...