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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7137ee7358078d09 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!h48g2000cwc.googlegroups.com!not-for-mail From: "Lucretia" Newsgroups: comp.lang.ada Subject: Re: Basic Explaination of OO in Ada Date: 18 Sep 2006 12:37:16 -0700 Organization: http://groups.google.com Message-ID: <1158608236.142716.178180@h48g2000cwc.googlegroups.com> References: <1158593087.194781.250030@e3g2000cwe.googlegroups.com> NNTP-Posting-Host: 62.56.117.104 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1158608241 26945 127.0.0.1 (18 Sep 2006 19:37:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 18 Sep 2006 19:37:21 +0000 (UTC) In-Reply-To: <1158593087.194781.250030@e3g2000cwe.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060903 Firefox/1.5.0.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h48g2000cwc.googlegroups.com; posting-host=62.56.117.104; posting-account=G-J9fgwAAADgpzBiEyy5tO4f8MX5fbpw Xref: g2news2.google.com comp.lang.ada:6642 Date: 2006-09-18T12:37:16-07:00 List-Id: Hi, One thing that (I don't think) is really explained clearly enough is the idea of *class-wide*. For example a class-wide type is one which consists of every type in that hierarchy, take this hierarchy: Shape + Circle + Polygon + Square + Triangle If you were to say Shape'Class, this basically means any type in the Shape hierarchy, and if you were to say Polygon'Class this means anything in the Polygon hierarchy (but not including Shape). Another part of the class-wide is the subprogram, a class-wide subprogram applies to all types in that hierarchy and cannot be overridden - it can be overloaded though: function X(Self : Shape'Class) return Float; This function applies to Shape, Circle, Polygon, Square, Triangle, whereas: function Circumference(Self : Circle'Class) return Float; Applies onto to the hierarchy rooted at Circle (nothing below it - you can't pass a Shape to that function). I found this confusing because the literature isn't (IMO) clear. Luke.