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:36:35 -0500 To: (Usenet)
Ben Measures wrote:
> >>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
> 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
> > 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
> 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!
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"...
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]