I've taken out the old header <iostream.h> and replaced it by the current <iostream>. I've adding in
using namespace std; where I've need to, in order to allow me access to
cin and
cout without a need to prefix then with
std:: under the new header file (and to save me loads of errors at load time when other standard stuff is loaded!). And I've commented out the supressions of deprecated warnings from my makefile -
# COPTS = -Wno-deprecated
I've taken the opportunity to add in to many of the main programs ... adding samples of how they compile and run, so that you can see what the programs do. Nothing to do with the way they work - everything to do with making them better examples when delegates come back and look and see how programs on their courses worked.
An update log for
the basic defining and using classes in C++ module:
All in one first demo
[here] replaces previous all in one demo
[here].
Separating that into two files - the new main program
[here] replaces the previous
[here], but the included functions are unaltered
[here]. I
have added a few comments to the latter file, but as none of the executable statements nor C preprocessor directives has been changed, I have not provided a duplicate file on this site.
Use of a header (include) file and methods held in a separate file - main program of the demo
[here] replaces previous version
[here]. The include file
[here] and functions
[here] are unchanged.
An example with a specific contructor and destructor. The new class code is
[here] and the previously used class code
[here]. The new main program is
[here] and the previous version
[here]. Note that the only reason that I've had to change the class code at all is that I have added uses of
cout in the constructor and destructor - as a demonstration so that the user / person running the code can see when they're called. You would certainly not want to do this in production code.
For completeness, the new makefile is
[here] replacing the previous one
[here].
(written 2010-07-04)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
C239 - C and C based languages - Putting it all together [836] Build on what you already have with OO - (2006-08-17)
[925] C++ - just beyond the basics. More you can do - (2006-11-14)
[945] Code quality counts - (2006-11-26)
[1181] Good Programming practise - where to initialise variables - (2007-05-09)
[2646] Compile but do not run PHP - syntax check only - (2010-02-22)
[2673] Multiple Inheritance in C++ - a complete example - (2010-03-12)
[2674] Make and makefiles - a commented example to help you learn - (2010-03-12)
[3067] Using C and C++ functions in the same program - how to do it - (2010-11-24)
[3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
[3252] C++ - unknown array size, unknown object type. Help! - (2011-04-17)
[3810] Reading files, and using factories to create vectors of objects from the data in C++ - (2012-07-21)
[4326] Learning to program - comments, documentation and test code - (2014-11-22)
[4374] Test driven development, and class design, from first principles (using C++) - (2014-12-30)
[4559] When do I use the this keyword in C++? - (2015-10-29)
C051 - C and C based languages - C++ - General [2370] C++, Python, and other training - do we use an IDE - (2009-08-21)
[2504] Learning to program in ... - (2009-11-15)
[2536] All the Cs ... and Java too - (2009-12-13)
[2577] Complete teaching example - C++, inheritance, polymorphism - (2010-01-15)
[2763] Our C and C++ training course are on Open Source platforms - (2010-05-13)
[3052] Getting your C++ program to run - (2010-11-15)
[3129] Extra courses - C and C++ - (2011-01-12)
[3155] Rake - a build system using code written in Ruby - (2011-02-03)
[3250] C++ - how we teach the language and the concepts behind the language - (2011-04-17)
[3587] C++ Courses - do I get official certification at the end of my Well House course? - (2012-01-20)
[3809] Dwarf Exception Unwind Info - (2012-07-20)
[4335] Flexible public courses - residential or commuting, programming newcomer or experienced, C or C++ - (2014-11-30)
[4355] C++ in 2 days - (2014-12-18)
Some other Articles
Train Services - Melksham to Bath and Bristol (and airport)Melksham Food and Drink Fair and Town Crier CompetitionTransport in Wessex - today and into the futureAtworth Village Fete - on the Melksham Community Area Partnership standFurther C++ material - view new or oldFresh Paint for course presentation - including C++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 friend