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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,760a0492b97ae06e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-19 09:24:21 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!82-43-33-75.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: Nick Roberts Newsgroups: comp.lang.ada Subject: Re: How to test object hierarchy Date: Fri, 19 Dec 2003 17:24:12 +0000 Message-ID: References: <93172edb.0312181024.9a536b2@posting.google.com> NNTP-Posting-Host: 82-43-33-75.cable.ubr01.croy.blueyonder.co.uk (82.43.33.75) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1071854660 8492713 82.43.33.75 ([25716]) User-Agent: Mozilla/5.0 (Windows; U; Win95; en-GB; rv:1.5) Gecko/20031007 X-Accept-Language: en-gb, en, en-us In-Reply-To: <93172edb.0312181024.9a536b2@posting.google.com> Xref: archiver1.google.com comp.lang.ada:3571 Date: 2003-12-19T17:24:12+00:00 List-Id: Pierre Favier wrote: > I am wondering how to test for two objects which types both derive from > a common root type if one of them derives from the other. In short, I am > trying to run something like the following code which does not compile > because the Class attribute applies to types or subtypes but not to > objects ... > > Any suggestions on how to achieve the intended effect? I feel this is a bit like someone asking how to scratch his ear with his foot. I suspect the most sensible answer might be "Don't do that." Since, within the procedure Test_Hierarchy, the only operations available for either Obj1 or Obj2 are the operations of the type Root_Object, how can it be of any significance to the code inside this procedure what relation (deeper in the hierarchy) the objects have to each other? Surely the code inside the procedure sees only two objects which obey the interface of Root_Object? I would guess, therefore, that there is an error of logic (or perhaps of style) in your program, but if you think not then by all means please give more details of what you are really trying to do. -- Nick Roberts __________________________________________________________ | Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~