Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!att!cbnewsb!ldg@drywit.ATT.COM From: ldg@drywit.ATT.COM (XMRB30000-GibbonsD(DRR6702)262) Newsgroups: comp.lang.c++ Subject: Re: Pointer to member function - Bug??? Message-ID: <161@cbnewsb.ATT.COM> Date: 29 Dec 89 15:16:30 GMT References: <2580@erix.ericsson.se> Sender: news@cbnewsb.ATT.COM Reply-To: ldg@druhi.ATT.COM Lines: 28 From article <2580@erix.ericsson.se>, by euaeny@euas10c19.ericsson.se (Erik Nyquist): > > Why isn't the program accepted? > main(){ > D d; > void (B::*bfunction)(char*) = B::b_method; > (d.*bfunction)("Hallo, World!"); > bfunction = D::d_method; > (d.*bfunction)("Goodbye, World!"); > } > This code is an error and the Sun compiler correct. The line bfunction = D::method; is attempting to assign a ptr-to-D-member to to a ptr-to-B-member. The passage on pg 26 of the C++ Reference Manual sanctions just the opposite operation. -- -------------------------------------------------------------------------------- -- Doug Gibbons | ldg@druhi.ATT.COM or att!druhi!ldg -- AT&T Bell Laboratories -- Denver CO