Advertisements

On Jul 11, 1:08 pm, Victor Bazarov <> wrote:
> wink wrote:
> > I'd like to determine if a method has been overridden as was asked
> > here:
>
> >http://www.velocityreviews.com/forums/t564224-determining-whether-a-d...
>
> > The answer was can't do it, but I thought I'd ask here [...]
>
> So, the replies of two experts who frequent this newsgroup are not
> enough for you, are they?

Sorry didn't realize it was an authoritative response.
>
> Let me ask you this: why do you think you need to know whether the
> function has or hasn't been overridden?

I was writing test code and didn't want to do the test if
the method wasn't overridden.
>
> > Any suggestions on how this can be done?
>
> No, not really. The language does not have the mechanism probably
> because it is not necessary in a normal course of C++ programming.

So I guess if it becomes really important I'll have the author
of the derived calls communicate the information to the test code
directly.

On Jul 11, 1:00 pm, wink <> wrote:
> I'd like to determine if a method has been overridden as was asked
> here:
>
> http://www.velocityreviews.com/forums/t564224-determining-whether-a-d...
>
> The answer was can't do it, but I thought I'd ask here, my test code
> is:
>
>...
>
> The compiler (gcc 4.0.3) complains:
>
> tor.cc: In function 'void test(const B&)':
> tor.cc:22: error: ISO C++ forbids taking the address of a bound member
> function to form a pointer to member function. Say '&B::m'
>
> Any suggestions on how this can be done?

The g++ compiler does allow taking the address of a bound member
function as a C++ language extension. Essentially, the C++ program
must be compiled with a "-Wno-pmf-conversions" flag. There is also
some unusual syntax required to obtain the address of the bound member
pointer. For details, see this comp.lang.c++.moderated post of mine:

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!