From: Sébastien <seb.morand@gmail.com>
Subject: Overriding : a nice one for ada
Date: Thu, 22 May 2008 14:44:07 +0000
Date: 2008-05-22T14:44:07+00:00 [thread overview]
Message-ID: <g140rr$iru$1@registered.motzarella.org> (raw)
Hi,
Just to share a discussion with colleagues today.
Here is what one asked to us (I write in pseudo OO code)
Class Bar =>
public test() =>
call testPublic;
call testPrivate;
public testPublic();
private testPrivate
Class Foo =>
public testPublic();
private testPrivate();
We do not care about testPublic and testPrivate behaviour, the code is
when you create a Foo object and you call test, which method is goind to
be called ?
PHP : Foo.testPublic and Bar.testPrivate
C++ : Foo.testPublic and Foo.testPrivate
Java : Foo.testPublic and Bar.testPrivate
Ada : Whoever you ask because at compile time you have to say
Do I override ? ("[not] overriding" keywork tell you what you are
doing) : And compiler requires not overriding testPrivate and overriding
testPublic ... so no more surprise
In test you have to ask yourself : do I call test with Call type or
Call wide-type ?, one more time, no more surprise.
So in the three first languages ... that's a surprise : No compilation
warning, no compilation error, just a result you have to know and a
different behaviour. In Ada, no surprise, the compiler requires from you
what to explicit what are going to do or doesn't compile ...
There is some new adepts of Ada over here :-)
Sebastien
reply other threads:[~2008-05-22 14:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox