Hi Jacob,
Well, I regret to say I think your discussion of utensils was more
confusing than it needs to be. You lost me a bit there when discussing
the utensils and I know what inheritance is. When discussing
inheritance and multiple inheritance I think any examples should be as
simple as possible to get the salient points across. That's why I
prefer to use animals as a talking point.
For example, a master class might be called animal. It would have
functions for walk, swim, have hair color, etc. A subclass or child
class of animal would inherit the functionality of animal, but add or
build special functionality on top of it. Say a dog class would add
pant, bark, wag tail, wine, etc. A cat subclass would inherit the
animal class, but add special functionality like purr, meow, hiss, and
so on. Each starts with animal as a base class, but builds on it and
gets more specialized as you work your way down through the different
levels. If I really wanted to I could further divide my code up into a
master class like animal, then have a mammal subclass, with cat, dog,
and rabbit, as child classes of mammal. That's the easiest way I know
of to explain inheritance.
Cheers!
On 8/9/13, Jacob Kruger <[email protected]> wrote:
Might be a form of OT reply, but, when try to explain
entities/classes/object oriented programming to people, one of the
common
examples I bring up to explain concept of parent-child/inheritance is
something like utensils - know sounds silly, but bear with me...<smile>
As in, in the kitchen drawer you store utensils, and they all share some
similarities, like generally being made of metal, or plastic, but, then
there are some general attributes/properties that different utensils
might
all have in common, like length, materials, colours collection, and
targeted
meal types/usage, or target ingredient types.
Then when you take it further, there are, say 3 specific/separate types
of
utensils - knife, fork, and spoon, and each of these children of the
utensil
parent class/object has a few of it's own specific forms of
properties/attributes - knives are of different types, and also include
further attributes/children types like steak knife, serration, edge
type,
point type, and general functionalities, whereas forks would
specifically
focus on something like shape of and number of points, and then with
spoons,
you might again have at least 3 child types - table spoon, dessert spoon
and
teaspoon, and all of these might, for example share a specific
property/attribute relating to cubic capacity, which would therefore
have
been assigned to the spoon type/entity, etc. etc....LAM!
(laughing-at-myself)
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
---
Gamers mailing list __ [email protected]
If you want to leave the list, send E-mail to
[email protected].
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/[email protected].
If you have any questions or concerns regarding the management of the
list,
please send E-mail to [email protected].