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 as below, or enter http://melksh.am/nnnn for individual articles
C233 - C and C based languages - OO in C++ - beyond the basics [798] References and Pointers in C++ - (2006-07-10)
[801] Simple polymorphism example - C++ - (2006-07-14)
[831] Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13)
[925] C++ - just beyond the basics. More you can do - (2006-11-14)
[1217] What are factory and singleton classes? - (2007-06-04)
[1572] C - structs and unions, C++ classes and polymorphism - (2008-03-13)
[1674] What a lot of files! (C++ / Polymorphism demo) - (2008-06-12)
[1819] Calling base class constructors - (2008-10-03)
[2577] Complete teaching example - C++, inheritance, polymorphism - (2010-01-15)
[3056] C++ - a complete example with polymorphism, and how to split it into project files - (2010-11-16)
[3123] C++ objects - some short, single file demonstrations - (2011-01-07)
[3124] C++ - putting the language elements together into a program - (2011-01-08)
[3142] Private and Public - and things between - (2011-01-22)
[3244] C and C++ - preprocess, compile, load, run - what each step is for - (2011-04-12)
[3251] C++ - objects that are based on other objects, saving coding and adding robustness - (2011-04-17)
[3508] Destructor methods in C++ - a primer - (2011-11-05)
[3811] Associated Classes - using objects of one class within another - (2012-07-21)
[3979] Extended and Associated objects - what is the difference - C++ example - (2013-01-18)
[4356] Object factories in C++, Python, PHP and Perl - (2014-12-19)
[4375] Final examples for 2014 - and a look at our 2015 training course options - (2014-12-31)
[4377] Designing a base class and subclasses, and their extension, in C++ - (2015-01-01)
[4559] When do I use the this keyword in C++? - (2015-10-29)
[4560] Variables, Pointers and References - C and C++ - (2015-10-29)
C231 - C and C based languages - Introduction to C++ [317] Programming languages - a comparison - (2005-05-20)
[318] Choosing a theme - (2005-05-20)
[336] Targetted Advertising - (2005-06-05)
[928] C++ and Perl - why did they do it THAT way? - (2006-11-16)
[2004] Variable Scope in C++ - (2009-01-22)
[2169] When should I use OO techniques? - (2009-05-11)
[3052] Getting your C++ program to run - (2010-11-15)
[3053] Make - automating the commands for building and installing - (2010-11-16)
[3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
[3250] C++ - how we teach the language and the concepts behind the language - (2011-04-17)
[4466] Moving from C to C++ - Structured to Object Oriented - a lesson for engineers - (2015-03-28)
[4561] Hello World in C++ - a first program, with the process explained - (2015-10-30)
[4562] Left shift operator on an output stream object - C++ - (2015-10-30)
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