Y'ello Benjamin!
BLM> "Object Oriented Programming" is mostly hype first of all.
It certainly is not (getting defensive!). It is a very powerful design
methodology which encourages good programming practise, and is capable of
producing safe, resuable code.
BLM> I have never seen a clear definition of object oriented
BLM> programming.
Well, ma freen' you've been looking in the wrong places. :) Somebody in
his
echo posted a brilliant description of exactly what OOD is. I wouldn't even
attempt to compete with that. But... ;)
Instead of thinking about what you want to do in a program, you decide what
the
components are within the system. Then you decide what data those components
should have, and then how you want to manipulate that data. From that flows
your object design, and then you can decide how they interact and so on.
BLM> If it was a tangible thing I think somebody would
BLM> be able to provide a basic description of it.
It is certainly tangible, inasmuch as any way of thinking can be. Let me
ive
you an example. Let's say we wanted to model everything in a horse racing.
traditional procedural programmer would probably start thinking about writing
functions to run a race, place bets and so on. Whereas an OO programmer
ould
say, what have we got... well:
Horses, Owners, Courses, Punters...
Then you would start thinking about what data is required. Well, a Horse has
a
name, an Owner... and so on.
BLM> As far as I can
BLM> tell it is simply a way of protecting data by making sure that
BLM> only code within an "object" can access the data that is within
BLM> the same "object".
Spot on, that's called Data Hiding, and also relates to Encapsulation. Data
is
hidden along with methods which relate to that data.
BLM> I'm sure there are other features that I'm
BLM> missing but as nobody seems willing to volunteer anything other
Well, how about Inheritance. This allows you to design basic objects, and
dd
to them more functionality. For example:
Mammal
|
Dog a dog IS A mammal
|
Terrier a terrier IS A dog
Other things can be mammals too:
Mammal
|-----------+
Dog Human
| |
Terrier +---+---+
| |
African European
And so on. Inheritance is a huge subject area. C++ allows Multiple
Inheritance, so that, for example:
Mammal Pet
| |
Dog---------+ dog IS A mammal, dog IS A pet
|
Terrier
There are many other issues... others have said them, I don't wish to
peat.
BLM> Classes are just like structs EXCEPT classes can contain code as
BLM> well as data.
Sort of, but that's a C programmer's thinking... (no offense). It would
probably be a bad idea to try to describe OO using C++. It would better to
get
a book on OO Anaylsis & Design (which I have but have lent to someone--Grady
Booch's book) which explains everything, perhaps using examples of C++ code.
BLM> If you understand classes, you understand alot of C++.
True, but as I say, I think that would be the wrong end to start from.
etter
understand the theory which, incidentally, applies to many languages...
ASIC,
Pascal, Smalltalk, Java, LISP (help us all) and even bloomin' Prolog! So,
while
I would be the first to say C++ is great, I don't think you want to learn
about
OOA&D from the language. But once you understand the concepts, you will jump
with glee at how things are done in C++. It is a very powerful, exciting
language to use. At least, that's what I think.
Have fun!
Fido = 2:259/33
--Craigzilla++ Internet = McMoose@sol.co.uk
WWW = http://www.taynet.co.uk/users/mcmoose/
--- GEcho 1.00
---------------
* Origin: The Kilted Bun, Letham Angus -- hame o' the McMoose (2:259/33)
|