We can end up with a lot of files when we do even a simple C++ example to show inheritance - a file for the main program, a file each for the base class and subclass, and a header file for the prototypes for each of the base class and subclass too.
So it's much easier to do it all as one file - but suggest to the delegates that the code should be split across multiple files once it's functioning. And I have added an example -
[here] - to our web site to show the fundamentals all in one, to give newcomers to objects and inheritance in C++ an easy start.
(written 2010-07-01)
Associated topics are indexed under
C231 - C and C based languages - Introduction to C++ [3250] C++ - how we teach the language and the concepts behind the language - (2011-04-17)
[3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
[3053] Make - automating the commands for building and installing - (2010-11-16)
[3052] Getting your C++ program to run - (2010-11-15)
[2169] When should I use OO techniques? - (2009-05-11)
[2004] Variable Scope in C++ - (2009-01-22)
[928] C++ and Perl - why did they do it THAT way? - (2006-11-16)
[336] Targetted Advertising - (2005-06-05)
[318] Choosing a theme - (2005-05-20)
[317] Programming languages - a comparison - (2005-05-20)
C233 - C and C based languages - OO in C++ - beyond the basics [3508] Destructor methods in C++ - a primer - (2011-11-05)
[3251] C++ - objects that are based on other objects, saving coding and adding robustness - (2011-04-17)
[3244] C and C++ - preprocess, compile, load, run - what each step is for - (2011-04-12)
[3142] Private and Public - and things between - (2011-01-22)
[3124] C++ - putting the language elements together into a program - (2011-01-08)
[3123] C++ objects - some short, single file demonstrations - (2011-01-07)
[3056] C++ - a complete example with polymorphism, and how to split it into project files - (2010-11-16)
[2577] Complete teaching example - C++, inheritance, polymorphism - (2010-01-15)
[1819] Calling base class constructors - (2008-10-03)
[1674] What a lot of files! (C++ / Polymorphism demo) - (2008-06-12)
[1572] C - structs and unions, C++ classes and polymorphism - (2008-03-13)
[1217] What are factory and singleton classes? - (2007-06-04)
[925] C++ - just beyond the basics. More you can do - (2006-11-14)
[831] Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13)
[801] Simple polymorphism example - C++ - (2006-07-14)
[798] References and Pointers in C++ - (2006-07-10)
Some other Articles
What are C++ references? Why use them?C course - final course example puts it all togetherLocal information for Melksham Hotel GuestsCatching up with an old friendObjects and Inheritance in C++ - an easy startLearning about Regular Expressions in C through examplesString functions in CStaring a C course with Hello World - why?C Course exercise and sample answer - source in 2 filesJust pass a pointer - do not duplicate the data