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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,436e4ce138981b82 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-10 08:01:38 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.octanews.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Wed, 10 Mar 2004 11:00:55 -0500 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: abstract sub programs overriding References: <1078776213.376775@master.nyc.kbcfp.com> <1078839257.157439@master.nyc.kbcfp.com> <5cmr40t76va200betf07b7bd6er05ltto9@4ax.com> <1078845298.702789@master.nyc.kbcfp.com> <0ipr40thtf86b520a0qdi003aj87gtuhd4@4ax.com> <1078849973.701176@master.nyc.kbcfp.com> <1078924150.268074@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1078934469.744922@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@aphelion.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1078934470 28987 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:6214 Date: 2004-03-10T11:00:55-05:00 List-Id: Robert I. Eachus wrote: > No, Ada semantics is that each object of a tagged type contains a tag. Yeah, I actually know that. It's the same in C++. The standard doesn't require any particular implementation. I think you could even do DK's fat pointers if you wanted. But it's so conventional to have a vtable pointer in the object that I just used that as shorthand. > To answer your specific question I don't think you're answering to the issue at hand. The first question is, if you have a class hierarchy where each class has an Initialize defined for itself, and you create an object of the most derived class, does Ada arrange for all of the Initialize procedures to be called, or does each Initialize need to explicitly invoke its parent? The second question, or observation, is that however it's called, a parent Initialize can view-convert its object to classwide type and call a dispatching procedure on it. This means that a derived class procedure might be called from a parent Initialize before its own Initialize has prepared the class. I'm not saying this is common, but DK was saying that this couldn't happen in Ada, and I'm saying that it can. It can't happen in C++, but in excahnge, C++ can dispatch to an abstract procedure, which is formally undefined behavior, but which implementations generally turn into an immediate abort, so that the problematic call can be found.