DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   c++ design problem (http://www.daniweb.com/forums/thread141365.html)

kneiel Aug 20th, 2008 3:50 pm
c++ design problem
 
i have two classes. One is room and the other is container.Room is the class which you write, container is a 3rd party class, you can't change
the class definition of container.

in the constructor of container, large amount of memory is allocated.
In the ctor of room, a small amount of memory is allocated.
Would you go in for an inheritance relationship or a composition between 'room' and 'container' ?

A few conditions:
1. Container has functions like open and close which even room can use and MUST re-use
2. Containers ctor should not be called as it allocates huge amounts of memory.


All times are GMT -4. The time now is 12:08 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC