From 5405710969608566535
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c997c315a835018d
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-10-11 17:54:37 PST
Newsgroups: comp.std.c++
Path: gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!tadpole.com!news.dell.com!swrinde!menudo.uh.edu!uuneo!sugar!jabberwock!daniels
From: daniels@biles.com (Brad Daniels)
Subject: Re: Implicit conversions for pointer-to-member
References: <60.1231.4352.0N18601B@canrem.com>
Organization: Biles and Associates
Date: Mon, 11 Oct 1993 22:01:56 GMT
Message-ID: <CEr6J9.74G@biles.com>
Lines: 33

In article <60.1231.4352.0N18601B@canrem.com>,
Gordan Palameta <gordan.palameta@canrem.com> wrote:
>Let D be a derived class of B, and Foo is some other class.
>
>
>Is this legal without an explict cast?
>
>       B Foo::*  <--   D Foo::*
>
>HP C++ 3.0 (based on cfront) seems to think so, IBM C++ and DEC C++
>disagree.
>
>I would think that this is really no different from the ordinary
>
>       B *  <--  D *
>
>and therefore should be allowed.

Language issues aside, the difference between the two cases is that
the conversion from D * to B * (or D to B - it's not clear which you're
talking about, but it doesn't matter anyway) may require additional code.
That code will not exist in a D::* member function, so when you invoke
the D::* function through a B::* member function, you will get an actual
D::* pointer interpreted as a B::*.  This situation is usually benign in
a single inheritance situation, but you will almost definitely get in trouble
if D also inherits from something other than B.

- Brad
-- 
----------------------------------------------------------------------
+ Brad Daniels			| "Let others praise ancient times;  +
+ Biles and Associates		|  I am glad I was born in these."   +
+ These are my views, not B&A's	|	  - Ovid(43 B.C - 17 A.D)    +


