From 3876181936551939629
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,4e0e65235aa5eceb
X-Google-Attributes: gidf78e5,public
From: Colin Rafferty <craffert@ms.com>
Subject: Re: pointer to member derivation question
Date: 1999/06/23
Message-ID: <vgvwvwuvaob.fsf@ms.com>#1/1
X-Deja-AN: 493117151
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <vgvk8swxj97.fsf@ms.com> <bill-2306990925210001@bgibbons.vip.best.com>
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
Organization: -
Keywords: derived,base,object,class
X-Attribution: >
Mime-Version: 1.0
User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) XEmacs/21.2 (Sakuragawa)
Newsgroups: comp.std.c++
Originator: clamage@taumet


Bill Gibbons writes:
> In article <vgvk8swxj97.fsf@ms.com>, Colin Rafferty <craffert@ms.com> wrote:

>> I have the following code, and it makes sense to me that it should
>> work, but different compilers have different thoughts on the subject.
>> 
>> class Base { /* ... */ };
>> 
>> class Derived : public Base { /* ... */ };
>> 
>> class Holder
>> {
>> public:
>>   Derived _derived;
>> };
>> 
>> void f()
>> {
>>   Base Holder::* elt = &Holder::_derived;
>> }
>> 
>> I don't have a copy of the standard, but the Dec 96 WP seems to say
>> nothing about it in either [dcl.mptr] or [conv.mem].

> Pointers to members can be converted implicitly from base to derived but
> must be explicitly converted from derived to base (so the above code is
> ill-formed).  This is backwards from ordinary pointers.

I think you are thinking of the opposite thing that I am looking for.
I know that I cannot implicitly convert from `Object Derived::*' to
`Object Base::*'.

This would allow me to refer to a member in Base that is only in
Derived.

However, this is not what I am doing.

I want to convert from `Derived Object::*' to `Base Object::*'.

I would like to see a reference to the standard that says that this is 
not allowed (or that it is allowed).

Thanks.

-- 
Colin


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




