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.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5eb8ca5dcea2827 X-Google-Attributes: gid103376,public From: Hyman Rosen Subject: Re: Ada OO Mechanism Date: 1999/06/03 Message-ID: #1/1 X-Deja-AN: 485319405 Sender: hymie@calumny.jyacc.com References: <7i05aq$rgl$1@news.orbitworld.net> <7i17gj$1u1k@news2.newsguy.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@panix.com X-Trace: news.panix.com 928428511 12954 209.49.126.226 (3 Jun 1999 16:48:31 GMT) Organization: PANIX Public Access Internet and UNIX, NYC Mime-Version: 1.0 User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.3 NNTP-Posting-Date: 3 Jun 1999 16:48:31 GMT Newsgroups: comp.lang.ada Date: 1999-06-03T16:48:31+00:00 List-Id: Matthew Heaney writes: > type Human_Type (<>) is tagged limited private; > procedure Marry (Bride, Groom : in out Human_Type); > This is a binary operation: > Marry (Linda, Paul); > The operation applies equally to both parties, so designating one object > as the distinguished receiver would not capture the abstraction as well. I see. I think at this point, C++ programmers would have to code the tag test themselves, but then the usage would look very similar. struct Human_Type { friend Marry(Human_Type &a, Human_Type &b) { if (typeid(a) != typeid(b)) throw "Marriage of unequals!"; a.Marry(b); } private: virtual void Marry(Human_Type &other) = 0; }; struct Lord : Human_Type { private: virtual void Marry(Human_Type &other) { Lord &other_lord = static_cast(other); //... } };