🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Avoiding ambiguities w/multiple inheritance

#2657
From: Jerry Coffin
Date: Sun, 19 Nov 1995 17:32
62 lines
2363 bytes
Dick Menninger <Dick.Menninger@daytonoh.attgis.com> wrote:

>I may be missing something, but
>I had the distinct impression that 'using'
>a base class's member function in a derived
>class solves much of your problem of choosing
>non-virtual functions from base classes and
>does so without overhead.  Of course, your
>compiler needs to support it.  Hopefully, VC++ 4.0
>really does support it and is correct in how
>it does support it.

Yes, the following compiles without errors:

class x {
public:  float z(float);
};
class y : public x{
public:  
    int z(long);
    using x::z;
};
int main() {
    y x;
    return x.z(1.2);
}

and seems to do the right things.  However VC++ 4.0 does not support:

`typename' as a keyword.
`bool' as a keyword.

code the overloads a virtual function based only on returning a derived
type, as in:

struct a {
	a &x();
};
struct b: public a {
	b &x();
};

It does improve its implementation of templates significantly, so
they're now roughly on a par with BC 4.5 - roughly as good as you can
get at the moment AFAIK, but they don't yet seem to support anything
like partial specialization.  Then again, since I haven't used partial
specialization before, I may have had the syntax a bit wrong - if
anybody cares to send me some code that's known to be legal, I'll be
happy to try it out.
    Later,
    Jerry.

/* I can barely express my own opinions; I certainly can't
 * express anybody else's.
 *
 * The universe is a figment of its own imagination.
 */


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <48mrhf$b3@natasha.rmii.com>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <luc.rogge.14.00BD3C10@rol.eunet.be> <DI3t5r.C2A@falcon.daytonoh.attgis.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: jcoffin@rmii.com (Jerry Coffin)
Newsgroups: comp.std.c++
Subject: Re: Avoiding ambiguities w/multiple inheritance
Date: 19 Nov 1995 17:32:32 GMT
Organization: TAEUS
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <48mrhf$b3@natasha.rmii.com>
References: <luc.rogge.14.00BD3C10@rol.eunet.be> <DI3t5r.C2A@falcon.daytonoh.attgis.com>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: slip8159.rmii.com
X-Newsreader: Forte Free Agent 1.0.82
Content-Length: 1496
Originator: clamage@taumet