From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fc9fc4716c48fb2 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news.germany.com!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 11 Jun 2008 17:02:48 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Interface specification in Ada References: <8bf0fc5b-3eac-4898-835c-93d40aca25e2@z66g2000hsc.googlegroups.com> In-Reply-To: <8bf0fc5b-3eac-4898-835c-93d40aca25e2@z66g2000hsc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <484fe918$0$6558$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 11 Jun 2008 17:02:48 CEST NNTP-Posting-Host: 84668004.newsspool3.arcor-online.net X-Trace: DXC=R]0CYPD]ae:nBOkdL^Lo7>McF=Q^Z^V384Fo<]lROoR18kF:Lh>_cHTX3j=kW9Bd12B<_= X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:652 Date: 2008-06-11T17:02:48+02:00 List-Id: christoph.grein@eurocopter.com schrieb: > You missed the "this" parameter, which is implicit in Java, but > explicit in Ada: > > package Bicycle is > type Object is interface; > > procedure changeCadence (Ob: in out Object; newValue : in Integer) > is abstract; And in Ada 2005 the "this" parameter can be suitably named, and when used, it can be written just like in Java, Peugeot: Bicyle.Object; Peugeot.changeCadence(27); Incidentally, I'd suggest you consider defining distict integer types that reflect gears etc. By doing so you can have the compiler check that a cadence number is not inadvertently used as a gear number. E.g., type Gear is range 1 .. 21; ... procedure changeGear (The_Bike: in out Object; newValue : in Gear) is abstract; or type Gear (Front_Wheel: Wheel_Number; Rear_Wheel: Wheel_Number) is private; and so on.