c++ design problem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 19
Reputation: kneiel is an unknown quantity at this point 
Solved Threads: 0
kneiel kneiel is offline Offline
Newbie Poster

c++ design problem

 
0
  #1
Aug 20th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC