[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
C++ inheritance and overloading problems
- To: <ravi>
- Subject: C++ inheritance and overloading problems
- From: Eric Dean Tribble <tribble>
- Date: Mon, 4 Dec 89 21:53:08 PST
- Cc: <xtech>
- In-reply-to: <Ravi>,55 PST <8912020030.AA07415@xanadu>
I'm not sure shadowing is a design bug. Imagine:
CLASS(Derived,Base);
Base::fun(Base * arg) {...}
Derived::fun(Derived * arg) {...}
...
{ Base * p;
Derived * q = new Derived();
p = Derived();
p ->fun(q);
}
I think this is the example I want. Think about the type resolution
rules required. I'm sure I could come up with an intractable example.
This results from the interaction between runtime dispatch and
compile-time dispatch. I expect they decided that subclasses can't
redefine the types of member functions without overriding the
inherited type.
dean