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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8047848c4805a99e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Classwide Parameter? Date: Tue, 12 Oct 2004 10:53:44 +0200 Organization: AdaCL Message-ID: <5720860.DVXme7QNW1@linux1.krischik.com> References: Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1097571569 03 1631 gGPoXFkO8EkXSgKv 041012 08:59:29 X-Complaints-To: usenet-abuse@t-online.de X-ID: bLTYRGZOQe8zHqdwJDVo89-J5r6jhF5+PW-O1Ebirb--xaljpg-7QD User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5076 Date: 2004-10-12T10:53:44+02:00 List-Id: matthias_k wrote: > Matthew Heaney wrote: >> matthias_k writes: >> >> >>>Thanks for that answer. However, I'm still having problems (I have >>>rewritten the code to be in one single package now): >>> >>> >>>package Graphics is >>> >>> type Shape is abstract tagged null record; >>> procedure Draw (Obj: Shape'Class); >> >> >> Get rid of this operation. It's a "class-wide" operation (like a static >> method in C++), and hence the operation isn't primitive for the type >> (and therefore doesn't dispatch). "static" would be a function in the same package but without any X or X'Class parameter. It's more like non virtual function. > Oha? I thought it would be analogous to 'virtual' in C++, not static. I did the same mistake in the beginning. In Ada all operations defined in the same package as the class are virtual. > If I leave out the method completely, then this is not what I know as > 'Inheritance' anymore. > Shape is supposed to be an abstract base class, which -declares- (not > necessarily -defines-) a common interface for its subtypes. The code I > posted may not reflect this too well, it's just samplecode. > I doubt -any- dynamic binding will happen when completely leaving out > Shape's Draw method. you need: procedure Draw (Obj: Shape) is abstract; which > And btw.: What does dispatch mean? :) Is that the Ada term for dynamic > binding? That's right. Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com