dynamic dispatch on operator arguments?
Date: Fri, 05 Nov 2004 12:12:39 -0800
Say I have a base class B and a derived class D.
Now I have some other class C in which I want to provide two functions:
void C::f(B* bObj);
void C::f(D* dObj);
The goal is that the version of f called should be determined by the
dynamic type of its argument. So if I had
B *pD = new D();
then cObj.f(pD) should call the second (D*) version of the function even
though the static type of pD is B*.
Is such a thing possible? If so, how?
- Re: dynamic dispatch on operator arguments?
... > Say I have a base class B and a derived class D. ... > dynamic type of its argument. ... Alwyn ...
- Re: Application.Run() problem
... still am very much confused about the paint event handler. ... It most obviously should be the derived class, ... It seems that you're not understanding how inheritance works. ... which ensures that the base class uses the same ...
- Re: Very Confused on Page 33
... On page 33 Bruce is explaining inheritance. ... > base class you can also send to objects of the derived class. ... The programmatic difference enables the subclass ...
- Re: attribute or subclass
... With inheritance the derived class code ... reference in place of the base class reference. ...
- Re: C# inheritance broken?
... class as a derived class, you can do the opposite though. ... Ignacio Machin ... issue of inheriting a base class ... You can't use a base class instance as though it were a derived class ...