From -1439680659520170637
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,4e0e65235aa5eceb
X-Google-Attributes: gidf78e5,public
From: Jim Hyslop <jim.hyslop@leitch.com>
Subject: Re: pointer to member derivation question
Date: 1999/06/25
Message-ID: <7ktjmc$95f$1@nnrp1.deja.com>#1/1
X-Deja-AN: 493630951
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <vgvk8swxj97.fsf@ms.com>
X-Original-Date: Thu, 24 Jun 1999 15:43:12 GMT
X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; U)
X-Http-Proxy: 1.0 explorer.zeus.leitch.com:80 (Squid/1.1.22), 1.0 x24.deja.com:80 (Squid/1.1.22) for client 127.0.0.1, 204.187.61.195
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Thu Jun 24 15:43:12 1999 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN3L4gqwEuYhIxRhxAQGDGAIAkDoQYgnbomcPnmskQSvouQx+suKzvc09 M/8y+iby10dCB+vJTHOuqwqaFg7C+DBahwpXHgF0Vyjag8j6E7lOvQ== =ad5e
Newsgroups: comp.std.c++

In article <vgvk8swxj97.fsf@ms.com>,
  Colin Rafferty <craffert@ms.com> wrote:
> Hi-
>
> 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;
>     }
Er, I hate to point out the obvious, but doesn't elt require an *object*
to work on, i.e.:

void f()
{
   Holder h;
   Base Holder::* elt = &h._derived;
}

BTW, you should avoid using leading underscores in identifiers, since
they are reserved for compiler and STL usage.

--
Jim
I ignore all email from recruitment agencies.
Please do not send me email with questions - post
here.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
---
[ 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              ]



