comp.lang.ada
 help / color / mirror / Atom feed
* Interface specification in Ada
@ 2008-06-11 12:46 Dennis Hoppe
  2008-06-11 13:04 ` christoph.grein
  0 siblings, 1 reply; 6+ messages in thread
From: Dennis Hoppe @ 2008-06-11 12:46 UTC (permalink / raw)


Hi,

my preferred programming language is Java and I'm used to declare in an 
interface some common methods, that all subclasses have to implement. 
For example:

interface Bicycle {
   void changeCadence(int newValue);
   void changeGear(int newValue);
   void speedUp(int increment);
   void applyBrakes(int decrement);
}

class RacingBicycle implements Bicycle {
    // remainder of this class implemented as before
}

If I accidentially implement RacingBicycle without providing the four 
methods mentioned above, the compiler would draw attention to this 
situation.

In Ada, i found the keyword "interface" only in the context of multiple 
inheritance. The usage would be:

package Bicycle is
    type Object is interface;

    procedure changeCadence (newValue : in Integer) is abstract;
    procedure changeGear (newValue : in Integer) is abstract;
    procedure speedUp (increment : in Integer) is abstract;
    procedure applyBrakes (decrement : in Integer) is abstract;
end Bicycle;


with Bicycle;

package RacingBicycle is

    type Object is new Bicycle.Object with null record;

    -- omitted needed procedures to raise an error
end RacingBicycle;


Unfortunately, the build process runs through without any errors. In 
this case, I want the compiler to notify me about missing procedure 
implementations, because they are declared abstract in the interface.

I think, I missed something in the hierarchy, but I don't see it.


Thank you in advance,
   Dennis Hoppe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-12  8:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-11 12:46 Interface specification in Ada Dennis Hoppe
2008-06-11 13:04 ` christoph.grein
2008-06-11 15:02   ` Georg Bauhaus
2008-06-11 16:34   ` Robert A Duff
2008-06-11 21:23   ` Dennis Hoppe
2008-06-12  8:37     ` Georg Bauhaus

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