Exercises, examples and other material relating to training module C238. This topic is presented on public courses Learning to program in C++
, C++ for C Programmers
, C and C++ Programming
You may have heard of design patterns - factories,
singletons and the like. The C++ template system provides
a base from which you can implement your design, whether
you've used UML or some other technique.
|Articles and tips on this subject||updated|
|3982||Using a vector within an object - C++ |
Background - why?
It's very common in program to have a whole lot of objects which when collected together make another object of a different type. That different object isn't going to be part of the same inheritance tree either - it's simply an associated object type / class.
That's a bit of an abstact ...
|3810||Reading files, and using factories to create vectors of objects from the data in C++|
On our C++ courses, we concentrate on objects and object design. But we also take a wider look at topics such as references and templates that go to making the complete language, with sections covering changes to things like file handling from the underlying C language.
I've just added a new example ...
|3509||Operator Overloading, Exceptions, Pointers, References and Templates in C++ - new examples from our courses|
I've added three new C++ examples to our library following on from last week's C++ course. Each of them is one step beyond "hello world" with regard to the particular feature it's showing, but isn't so advanced and showing so many options that it confuses the newcomer - at least that's the theory. ...
|3388||Templates in C++ - defining a family pattern of methods / functions|
In C, function names need to be unique. If you try to compile or load two functions of the same name, even with a different number / type of parameters, you'll get an error rather than a runnable file out of your compile / load process. See [here].
In C++, you can have methods (functions) in each class ...
|3252||C++ - unknown array size, unknown object type. Help!|
There are time when you're writing a program where you say "I don't know".
• I don't know how many records / object I'm going to read from a data file into an array - so I can't set the size of my array
• I don't know what sort of object I'll be creating from a line I've read from a data ...
|3245||Collections in C and C++ - arrays, vectors and heap memory blocks|
If you want to hold multiple values within a table in a program, you'll want to use some form of collection or table - and in many languages including C++ and C, the most straightforward type of collection is an array. An array occupies sequential locations in the computer's memory when your program ...
|1478||Some new C programming examples - files, structs, unions etc|
A series of new "C" examples have been added to the web site - a course for a small group allowed me to go somewhat away from the more normal run yesterday and write some new illustrations in front of them.
Call by value v call by pointer comparison: link
Using extern to share a variable between two ...
Examples from our training material
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
Template definition - parameterized types.
Templates and friends.
Static members and templates.
Exceptions and templates.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.