comp.lang.ada
 help / color / mirror / Atom feed
* Overriding : a nice one for ada
@ 2008-05-22 14:44 Sébastien
  0 siblings, 0 replies; only message in thread
From: Sébastien @ 2008-05-22 14:44 UTC (permalink / 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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-22 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22 14:44 Overriding : a nice one for ada Sébastien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox