Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)
From: Thomas Hansen (polterguy_at_gmail.com)
Date: 03/30/05
- Next message: kanze_at_gabi-soft.fr: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- Previous message: Thomas Hansen: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- In reply to: Ben Measures: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- Next in thread: kanze_at_gabi-soft.fr: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2005 03:36:35 -0500 To: (Usenet)
Ben Measures wrote:
[snip]
> >>And there are many strongly-typed functional programming languages.
> >
> > But their motivation is still the same, OO is just after all an
> > extremity of typesafety.
>
> Type safety merely mandates that the type of data objects is fixed
and
> does not vary over the lifetime of the object. This has nothing to do
> with the concepts emphasized by OOP.
>
> > Instead of having a method signature with a given type and issuing
a
> > compiler warning/error when trying to call the method with the
wrong
> > type you couple the method within the type making it impossible to
make
> > your sub fly...
> > In practise you're right, in theory I must declare that I
dissagree.
>
> Don't give your submarine a fly() method (unless you want it too, of
> course) :P .
The difference between a typesafe language and a non typesafe language
is that a typesafe language has some kind of built in logic to
guarantee that you don't try to submit a "submarine" parameter to a
function which takes an "aeroplane" object...
Not totally unlike the princips of binding the "can do" (functions)
with the type (data) as in classes.
If this happens compile time you have a guarantee that it will NEVER
happen, if this happens runtime (dynamically typed languages) you'd
better hope your function is being called with the "wrong parameter" in
your Unit Tests!
Example:
var x = 5
var y = "5"
var z = x+y
What's the z variable containing here?
At least four possible candidates exists.
10, 55, "55" and "error"...
[snip]
Thomas
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
- Next message: kanze_at_gabi-soft.fr: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- Previous message: Thomas Hansen: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- In reply to: Ben Measures: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- Next in thread: kanze_at_gabi-soft.fr: "Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]