This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problems invoking a member function through pointers.
- To: adriang at adriang dot ce dot mediaone dot net, egcs at egcs dot cygnus dot com
- Subject: Re: Problems invoking a member function through pointers.
- From: mrs at wrs dot com (Mike Stump)
- Date: Tue, 22 Dec 1998 11:14:55 -0800
> Date: Mon, 21 Dec 1998 23:08:06 -0600 (EST)
> From: <adriang@adriang.ce.mediaone.net>
> To: egcs@egcs.cygnus.com
> In the following code I would expect the output to be:
> Base::M1
> Base::M1
> Base::M2
> Base::M2
> To my surprise, the last line of the output says
> Derived::M2
This isn't the right group to learn C++ programming, comp.lang.c++ is
a better place. Yes, this is what virtual means. virtual means call
the most derived function in your class hierarchy. If you don't want
that behavior, don't use virtual.
obj.Base::M2 () != obj .* (&Base::M2) ()