Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business 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
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Object Orientation and General technical topics module Q909
Object Orientation: Composite Objects
Exercises, examples and other material relating to training module Q909. This topic is presented on public courses Learning to program in Python, Learning to Program in Java, Learning to program in Ruby, Learning to program in C and C++, Object Oriented Programming in PHP, Python Programming, Perl for Larger Projects, C++ for C Programmers, C and C++ Programming, Java Bootcamp, Ruby Programming, Java Programming for the Web, Intermediate Python, Learning to program in C and C++, C and C++ Programming

This is the second of three modules on Object Orientation which are equally applicable whether you're programming in Java or Perl, PHP or Python. Topics covered include Polymorphism, Inheritance and Overloading.

Related technical and longer articles

Articles and tips on this subjectupdated
4450Deciding whether to use parameters, conditional statements or subclasses
"If you find yourself repeating a piece of code, there must be an easier way" But what if you have a number of similar but not identical items / things / objects? If the things that change between each of your objects are just data values - for example the number and ages of childen - then you can handle ...
4394Philosophy behind object design - and how I applied in to a Java example
* When you're writing all the logic to deal with a particular type of data, it's a good idea to write it into a CLASS * Where you have similar types of data, it's a good idea to put the shared logic into a BASE CLASS and then write SUBCLASSES which are based on that base class. That way your common ...
4377Designing a base class and subclasses, and their extension, in C++
My first technical post for 2015 - looking back at some of last year's new C++ examples. Oh - OK - I'm writing this on 1st January and these examples were written and uploaded yesterday, so they're nothing like as old as it sounds. On Monday and Tuesday, I wrote classes from scratch and looked at basic ...
3979Extended and Associated objects - what is the difference - C++ example
When you use inheritance, you create a tree of object types, where one type is based on another. For example, you define a base class of "transport" and then you extend that to define similar classes with extras called "bus" and "train". That's a very different matter to using a class connected in ...
3609How do classes relate to each other? Associated Classes
How do classes relate to each other? Associated Classes ... or ... define: Associated classes, parent classes, superclasses, subclasses, base classes, abstract classes, interfaces and mixins. Associated classes are the odd ones out here. They're classes that are used within other classes. Let me ...
477Class, static and unbound variables
In Object Oriented programming, you'll have certain named blocks of code (usually known as methods) that you can perform on specific objects (type A), and others that you can perform on all the objects of a particular type (type B). Example. If I had a class called sandwich, I might have one method ...
3251C++ - objects that are based on other objects, saving coding and adding robustness
In a previous article ([here]), I talked about how we introduce the basic concepts of classes, methods and objects on our C++ courses. I'm now going to give you some links to the next series of example which I wrote during that same course. Having covered object basics, we moved on to look at related ...
3152Jargon busting
I've been reading a report on a minor railway accident which could have been much more serious - a crane driver swung a piece of rail he was replacing on one track in front of a train that was approaching on another line - [report here], and it struck me as I read just how many abbreviations / acronyms ...
3142Private and Public - and things between
A public train service is one which is available for anyone to travel on; a private one only takes limited passengers as invites / made available by the operator. And there could be intermediate levels too - I understand that at times the British Transport Police protect the last train from Weymouth ...
2922Getting the OO design write - with PHP a example
One of the great beauties of Object Oriented Design is that you can say "I want to handle a type of data that's based on an xxx", and if someone's already written (and made available) the code for an xxx, all you have do do is define the additions and differences, rather than starting from scratch. ...
2865Relationships between Java classes - inheritance, packaging and others
When you're designing classes in Java, you need to consider their relationship with one another in various ways. • You need to consider class INHERITANCE - which classes are based on which other classes. For example, a Pet could be based on (i.e. extended from) an Animal. • You need to consider ...
2641Object Oriented Programming in PHP
New ... for the first time ever ... our Object Oriented PHP Programming training course is running on a Monday. That's Monday, 26th April 2010. It then revert to Friday - its more normal day of the week - in May. PHP's roots were not object oriented ... and in the early days of it being used for ...
2170Designing a heirarcy of classes - getting inheritance right
You friend Will has written a class to handle management information about articles. It's great as far as it goes, but you want to add extra stuff to it, so you persuade Will to give you a copy. He's a nice guy, he does so ... but then a month later he tells you he's added a lot more code and you're ...
1348Screw it or Glue it? Access to Object variables - a warning
If you screw two pieces of material together, you have the opportunity, later on, to unscrew them ... resuse them differently, install a waterproof membrane between them, and so on. But if you glue them together, later modification will be much harder or perhaps impossible. And in a similar way, if ...
1345Perl and Shell coding standards / costs of an IT project
There are three major staff costs in the life of an IT project - the specification and development of the system, the maintainance and upgrading of the system though its life, and the investment that's made in data entry and integrity through the life of the system. And although there's a lot of thought ...
592NOT Gone phishing
Early last week, I was giving a training course on Perl and talking a little bit about Perl objects - how all the internal logic that's associated with a particular type of data can be hidden within a source file so that the person writing the code to call it up only needs to understand what to put in, ...
Examples from our training material
Anitest.java   Test Harness - Java
Anyanimal.java   Base class - Java
Farmanimal.java   Farm Subclass - Java
Petanimal.java   Pet subclass - Java
Shapes001.cpp   Framework for Inheritance example
Shapes002.cpp   Inheritance example - Constructors and first accessors
Shapes003.cpp   Adding a factory / static method
Shapes004.cpp   Adding test harness
Shapes005.cpp   Adding operator overloading
doggies.php   A set of classes in PHP, factory method, comparators and test harness
flightdemo.cpp   Associated object - in C++
puma.php   Inheritance, Overriding, Polymorphism, Object comparison of different types [Python]
transport.py   March 2015 / multiple classes in Python
whm3   Residents and Delegates - extended from customers [Python]
Background information
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
Base classes and subclasses.
What's inherited?.
Abstract classes.
Inheritance structure.
Multiple Inheritance.
Class structure.
Designing Objects.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses 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.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/Q909.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb