Main Content

Lots of things to do with and within a C++ class

Archive - Originally posted on "The Horse's Mouth" - 2010-11-16 17:58:40 - Graham Ellis

I've added a build up example - written during the current C to C++ conversion bootcamp - to our Further C++ OO Features module.

First step shows a simple class and test harness.

Second step adds a comparison of heap or stack objects, overloading of methods, static methods, more character handling, and the use of "this".

Third step adds destructors, delete, vectors, comparators, and factory methods.

These examples do NOT split the application and its class into separate files, nor have we used inheritance, extension, etc - these other vital topics are in other examples that you'll find in other nearby blog entries. The purpose of this particular post is to show you some of the very wide range of things that you'll need to do within a single class.