• Advertisement
Sign in to follow this  

OOP *help!*

This topic is 4651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This question could win an award for how vague it is, but: What are some of the best ways to deal with the life of object-oriented objects in C++? If someone could come up with a better wording, please tell me. :) [Edited by - Daniel Miller on May 31, 2005 1:40:47 PM]

Share this post


Link to post
Share on other sites
Advertisement
Smart answer ;)

Reference counted objects (like boosts smart_ptr) are one way, a real GC like boehm gc is another way.

[Edited by - Trap on May 31, 2005 3:16:48 PM]

Share this post


Link to post
Share on other sites
garbage collection - finds objects that aren't need and destroys them at a convienient time.

smart pointers - deallocates objects once the pointer goes out of scope AND there are no other references to the objects.

scoping - using braces { and } around objects limits their life span

statics - an objects existence and life-span are shared among instances.

singletons - similar to statics, these are objects that have global access-points and only exist once.

multi-threading - if not done correctly can inadvertantly destroy an object it shouldn't.

Share this post


Link to post
Share on other sites
Quote:
Original post by Daniel Miller
Thanks, I think boost is the best way to go.

It looks like it'll work like a dream.


Boost's smart pointer is good. So is Loki::SmartPtr.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement