Re: call base class function or derived class function



Sorry Igor,


My bad, it should be

int main()
{
Goo g;
g.goo();
return 0;
}

Any comments to my original question?


regards,
George

"Igor Tandetnik" wrote:

"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D2239B4B-C837-4A30-85E9-EF73BB005F1F@xxxxxxxxxxxxx
I am just a little confusing and not 100% confident about the
following case. In the following sample, function call foo (called in
function goo in class Foo) will call foo in class Goo

Your example never calls goo(). If it were called on some object, it
would call foo() override that belongs to the dynamic type of that
object.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



.



Relevant Pages

  • Re: Virtual function and multiple inheritance
    ... method in Derived which is not in Foo and Goo. ... virtual int myFunc() ... I'll make a guess that these two vtables are specific for Derived. ...
    (microsoft.public.vc.language)
  • Re: URGENT fast answer needed
    ... It will work similarly to grep except that it performs string replacement in addition to matching, and it does not support regular expressions or reading from standard input. ... our command will be called strep. ... foo a b c d foo e ... We could replace all occurrences of foo with goo as follows: ...
    (comp.lang.c)
  • Re: Virtual function and multiple inheritance
    ... containing two __vfptr is for the simple reason to maintain the ... It could be used in place of either a Foo or a Goo object, ... I'll make a guess that these two vtables are specific for Derived. ...
    (microsoft.public.vc.language)
  • Re: Virtual function and multiple inheritance
    ... __vfptr for Foo contains Derived overridden virtual methods for Foo, ... itself's virtual methods implementation, and __vfptr for Goo contains Derived ... Here pF is a pointer to an object with the same memory layout as a Foo ...
    (microsoft.public.vc.language)
  • Re: call base class function or derived class function
    ... function goo in class Foo) will call foo in class Goo ...
    (microsoft.public.vc.language)