Well House Consultants
You are on the site of
Well House Consultants
Open Source Training Courses
hotel accommodation. You are welcome to browse and use
our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Well House Manor Resources
Object Orientation and General topics
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
C and C++ Resources
Web and Intranet Resources
C and C based languages module C232
Defining and using classes in C++
Exercises, examples and other material relating to training module C232. This topic is presented on public courses Learning to program in C and C++
, C++ for C Programmers
, C and C++ Programming
, Learning to program in C and C++
, C and C++ Programming
How to set up your own classes of objects in
C++, and how to use those objects and also objects
that are available to you from elsewhwere. We also
introduce access levels in this module.
|Articles and tips on this subject||updated|
|4565||Allocation of memory for objects in C++ - Stack v Heap|
In C++, memory is allocated to variables on a stack or on a heap. Allocated on the stack, the variable persists until the end of the block in which it's defined. Allocated on the heap, the memory containing the object persists until the end of your program, or until you delete the object.
Stack memory ...
|4372||Template / design pattern for C++ constructor and accessors|
Would you believe I'm giving a C++ course on Monday, 29th December? If a customer wants a weekend or holiday time course, yes, we can arrange it!
From this afternoon - a first example in C++ - [here]. I've defined the API to a class, the class itself and the first (test) program all in the one file ...
|4129||Simple OO demonstration in C++, comparison to Python|
From last week's quick introduction to C++ (a private course - half a day added on to the end of a C Programming course - an example of how C++ implements objects for a newcomer to C++ who's seen some Python.
Firstly, in C++ you must predefine the API - the interface between the user and the class. ...
|3978||Teaching OO - how to avoid lots of window switching early on|
One of the major benefits of Object Oriented programming is the clear and sharp dividing lines it provides between the different sections of logic - where code dealing with one type of data is specified, written, stored and tested in different files to the code dealing with other types of data (or code ...
|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 ...
|3721||Naming blocks of code, structures and Object Orientation - efficient coding in manageable chunks|
Soon after you start to program, you'll learn that you want to re-use code. And that re-use will sometimes come in the form of loops, and at other times in the form of named blocks of code which you'll call up from multiple places in your program, or indeed from multiple programmers.
• A good ...
|3716||Learning C++ - a design pattern for your first class|
From today's C++ Course - a new, clear example of a design pattern for a simple class, its headers, and a test harness - [here].
When using an Object Oriented language, design patterns are really useful. Essentially, they're a known and standard way of combining the features of the language in a convenstional ...
|3250||C++ - how we teach the language and the concepts behind the language|
When I'm teaching an object oriented language such as C++, I like to write code and demonstrate from scratch to my class, getting them to 'feed' me with application data and information so that I can show them how programs are really developed using the OO approach - both in general, and in the specific ...
|2577||Complete teaching example - C++, inheritance, polymorphism|
On yesterday's C++ course, I provided a final example which illustrated polymorphism, and showed how even the simple example was best written, split, ito no less that seven source files.
1. The main C++ source code - for my example, a simple demo test harness
|2579||Creating, setting up and using objects in C++|
Early on this week's C++ programming course (including the C fundamentals), I wrote a new and short example that defined and used a class of objects of type "Hotel". Really, this initial example was very much shorter than any real program you would write and it used a very limited number of the facilities, ...
|2578||Where are your objects stored in C++?|
If you declare a variable to be of an object type in C++ (and potentially do so with parameters), you're going to be assigning memory for the variables that it includes on the stack - i.e. within memory that will be lost when you exit the closure (block of code - function - method) in which you are defining ...
|1925||Introduction to Object Oriented Programming|
"Object Oriented Programming" is a whole new philosophy for programmers who have been writing short scripts for years, and it can be quite frightening to learn with all these new buzzwords like "overriding", "encapsulation" and "polymorphism" creeping in. It's a beautiful concept and a lovely approach, ...
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 [here]
Topics covered in this module
Defining classes through struct and class.
Constructors and Destructors.
Private, Protected and Public.
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.