Wow, thanks for all the replies everyone!
in the process of following the Rule of Three in my code; after some
trial and error, I have a handle on the concept. It's a small project,
so I won't be using smart pointers yet - however I'll keep them in mind
for future projects.
Once again, thanks for all the insight and time!
As jwezorek says, you do want to learn and use smart pointers. Even in small projects. Smart pointers and STL containers are the preferred way of managing memory so that you don't have a leak.
The rule of three has it's place, but smart pointers make it much more rare.
I think you would be on a better track learning the Rule of Two and RAII (repeated because it was likely lost in the slew of other previous replies).
Honestly, RAII probably takes priority over either Rule or Three or Rule of Two, which is not to say the rules are not important, but RAII is just such a core principal that can and should be applied vigorously throughout all of your code, as it prevents memory leaks (even complicated ones caused by exceptions), failure to release file handles, failure to leave critical sections, failure to delete pointers, etc.
Failure to follow one of the Rules of X will bite you in the ass when you copy complex objects, but from a performance standpoint that is something you should be trying to avoid as much as possible anyway. While it is still sometimes necessary to copy complex objects, you will get bitten in the ass far more often by failing to release some resource or leave a critical section, as these cases simply happen magnitudes more often in practice than copying complex objects.
So once you have thoroughly employed RAII, Rule of Three no longer makes sense.
Better to prioritize RAII and then go with Rule of Two without wasting time on the less-safe (due to exceptions) and more time-consuming Rule of Three.
I agree that RAII is a concept that johnmarinelli needs to learn, but he could do without the rule of two. I made this objection earlier in the thread. You don't want a single object managing more than one resource. Also, writing a rudimentary smart pointer, then implementing different copy semantics on top of it, as link you showed suggests, is not, in my opinion, generally the best way to ensure RAII.
EDIT:These quote tag are very annoying to work with!
Edited by King Mir, 07 February 2013 - 08:47 PM.