From 3088401399547263278
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,4e0e65235aa5eceb
X-Google-Attributes: gidf78e5,public
From: Pete Becker <petebecker@acm.org>
Subject: Re: pointer to member derivation question
Date: 1999/06/26
Message-ID: <37737A36.42A64B22@acm.org>#1/1
X-Deja-AN: 494075054
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <vgvk8swxj97.fsf@ms.com> <7ktjmc$95f$1@nnrp1.deja.com>
X-Original-Date: Fri, 25 Jun 1999 08:46:46 -0400
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 930385824 16153 128.250.29.16 (26 Jun 1999 08:30:24 GMT)
Organization: Road Runner
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN3SPkuEDnX0m9pzZAQHQxAF+Pz4xsBti6vq7lyLm8KdHR0+r7Vl2hYSL KKFUestm5cZfDNxPf25xykhEyRiCnmby =wfNV
Mime-Version: 1.0
NNTP-Posting-Date: 26 Jun 1999 08:30:24 GMT
Newsgroups: comp.std.c++

Jim Hyslop wrote:
> 
> >     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.:

No, the code above is correct: elt is a pointer to member data, not an
ordinary pointer. There tends to be more discussion about pointers to
member functions, so the syntax for a pointer to member data looks
disarmingly simple. An ordinary pointer is even simpler:

    Base * elt = &h._derived;	// ordinary pointer
---
[ 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              ]



