Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)
From: Thomas Hansen (polterguy_at_gmail.com)
Date: 30 Mar 2005 03:35:29 -0500 To: (Usenet)
M Jared Finder wrote:
> > But their motivation is still the same, OO is just after all an
> > extremity of typesafety.
> > Instead of having a method signature with a given type and issuing
> > compiler warning/error when trying to call the method with the
> > type you couple the method within the type making it impossible to
> > your sub fly...
> > In practise you're right, in theory I must declare that I
> > But I guess this is one of those subjects where we all do alot of
> > armwaving and "you know what I mean" stuff...
> > At least in the theoretical perspective.
> > Let the chicken and egg problem pass us unnoticed!
> > ;)
> It seems to me like you're looking at OO backwards. OO to me is
> polymorphism, where you think of things in terms of shared interfaces
> and per-call implementations. What is dispatched on doesn't matter
> much to me as that the dispatch exists. The dispatch has the side
> effect of type-safety, but that has never seemed to me to be the
Might be OO is polymorphism for you, but the single most importent
feature today with OO according to it's "creators" is Data Hiding also
known as Encapsulation!
You've got a "black box" you know if you feed it a direction it will
try to move in that direction, how this is being done is up to the
implementation to decide.
If this is a shared interface, a template policy, a concrete class is
The point is that it may rely upon 500 non visible functions and 1000
private data-members which you don't even know exists!
Before OO we had stuff like (C) void * (typesafety), struct's where all
the data was "wide open" to manipulate for everyone (no encapsulation)
Basically if you had a bug somewhere you had a scope of "all the code".
After OO we could narrow that scope to only public functions and public
data in the class.
OO is about RESTRICTING developers from doing things (data hiding,
encapsulation, typesafety), not ENABLING them to do things
(polymorphism, inheritence etc.)
Ask your self how many times you've used virtual functions and how many
times you've used private data-members/function-members...
The perfect class has no public members, no public data, can not be
copied, can not be assigned to, can not be instantiated and can not be
That's the perfect class!
(ref: If something is available it will cause trouble! )
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]