🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1073

Re: Pure functions and derived classes

#1073
From: Ilan CARON
Date: Mon, 29 Apr 1991 15:39
30 lines
1755 bytes
In article <1991Apr18.233753.26738@menudo.uh.edu> st12a@menudo.uh.edu (richard henderson~) writes:
>
> [ hierarchy deleted]
>both BC++ and g++ complain that the pure functions Mid_a::func_b() and
>Mid_b::func_a() are not overridden.
>
>What is the proper way to declare this construction?  It seemed to me
>that Mid_a::func_a() should override Mid_b::func_a() and vice-versa.
>

[This cropped up a while ago...]

The problem is that Base is a *virtual* base of class Der.  I.e. there
is only one instance of Base in instances of Der. 

Consider now Base* pointers.  Note that the true type of instances 
referenced by such pointers could be only Der (since its base classes
are all abstract and as such non-instantiable").  The obvious question
then is "what should the contents of the vtable slot for say func_b()
be (in the vtable pointed to by Base* pointers)?"

Well... it's not clear.  Should it be &Mid_b::func_b()? (which is
a real address) or should it be some indication that the method
is a pure virtual (corresponding to the pure virtual in class Mid_a)?

In other words, an ambiguity.  And as such C++ doesn't let you declare
such classes (i.e. Der) since there's no way to construct such an
animal.

--ilan caron (uw-beaver!microsoft!ilanc)
Technical Details
Message-ID: <72081@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!microsoft!ilanc
References: <1991Apr18.233753.26738@menudo.uh.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!microsoft!ilanc
From: ilanc@microsoft.UUCP (Ilan CARON)
Newsgroups: comp.std.c++
Subject: Re: Pure functions and derived classes
Keywords: Pure functions
Message-ID: <72081@microsoft.UUCP>
Date: 29 Apr 91 15:39:03 GMT
References: <1991Apr18.233753.26738@menudo.uh.edu>
Reply-To: ilanc@microsoft.UUCP (Ilan CARON)
Organization: Microsoft Corp., Redmond WA
Lines: 30