There were no less than SEVEN files in the example I wrote to show a "simple" demonstration of polymorphism in C++ yesterday ...
1. The methods for a base class of file objects - Film.cpp
2. The extra methods on top of the base class for a derived class of Blockbuster objects - Blockbuster.cpp
3. The extra methods on top of the base class for a derived class Cinema.cpp
4. The header file Film.h, for inclusion in each of the above
5. The header file Cinema.h for inclusion in that extended class and the test application
6. The header file Blockbuster.h for inclusion in that extended class and the test application
7. The test application - flix.cpp
Why so many files?
a) Because C++ is a language that is designed for the larger application, and it's not really intended for tiny programs such as this - the seven files are indeed a lot to start off with, but the code can be extended from this trivial job up to something much MUCH bigger.
b) Because each of the sections might be maintained by a separate programmer and so it's a good structure through which that maintainance can be done independently
c) Because the use of header files which are included in two or more of the sections of program allows the programmers to maintain a single set of method descriptions rather than duplicated code, with all the synchronisation and extra headaches that might bring.
And these are all excellent reasons, aren't they?
The complete example is in our source code library. But I have NOT put all seven files up separately, to produce a heptagonal array of extra window when you click on the link ... just click here for a single extra window containing all the source
to see the whole example in one go. (written 2008-06-12)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesC233 - C and C based languages - OO in C++ - beyond the basics 
Variables, Pointers and References - C and C++ - (2015-10-29) 
When do I use the this keyword in C++? - (2015-10-29) 
Designing a base class and subclasses, and their extension, in C++ - (2015-01-01) 
Final examples for 2014 - and a look at our 2015 training course options - (2014-12-31) 
Object factories in C++, Python, PHP and Perl - (2014-12-19) 
Extended and Associated objects - what is the difference - C++ example - (2013-01-18) 
Associated Classes - using objects of one class within another - (2012-07-21) 
Destructor methods in C++ - a primer - (2011-11-05) 
C++ - objects that are based on other objects, saving coding and adding robustness - (2011-04-17) 
C and C++ - preprocess, compile, load, run - what each step is for - (2011-04-12) 
Private and Public - and things between - (2011-01-22) 
C++ - putting the language elements together into a program - (2011-01-08) 
C++ objects - some short, single file demonstrations - (2011-01-07) 
C++ - a complete example with polymorphism, and how to split it into project files - (2010-11-16) 
Objects and Inheritance in C++ - an easy start - (2010-07-01) 
Complete teaching example - C++, inheritance, polymorphism - (2010-01-15) 
Calling base class constructors - (2008-10-03) 
C - structs and unions, C++ classes and polymorphism - (2008-03-13) 
What are factory and singleton classes? - (2007-06-04) 
C++ - just beyond the basics. More you can do - (2006-11-14) 
Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13) 
Simple polymorphism example - C++ - (2006-07-14) 
References and Pointers in C++ - (2006-07-10)
Some other Articles
Software - changes and delays. But courses must run on time!CSS training - Cascading Style Sheets (UK course)A warm welcome for visitors from the USAComparing Objects in C++What a lot of files! (C++ / Polymorphism demo)Spam Filters ... are working!The Composting Cone ChallengeCompiling C programs with gcc - an overviewDynamic Memory Allocation in CWhat are Unions (C programming)