Re: deallocating cars and tow trucks...


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by Raheel Aidrus on December 03, 2001 at 20:45:05:

In Reply to: deallocating cars and tow trucks... posted by Yoon-Soo on December 03, 2001 at 03:31:43:

What I did in my project was similar to what you are doing. The street shouldn't be responsible for creating cars...it just has pointer to them (think of a real street). I have the street destructor and the dispatcher destructor delete all the dynamic memory, because after they are destructed, there is no logical use of the cars or the trucks.

: In my case, the controller is responsible for creating cars and tow trucks...
: Later on when I started to worry about memory leak, this question came up to my mind...

: What is responsible for deallocating the cars and tow trucks(when the probram ends)...

: Should the controller class hande it, since they are created in the controller class?

: Or should the Street class and the Dispatcher class handle it, since the dynamically allocated pointers are part of the street object or the dispatcher object's tow truck list?

: Am I not getting what association and dynamic allocatino is all about??? Very worried...please help me!!!




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]