BP> struct base {
BP> int f();
BP> int f(int,int);
BP> } ;
BP> struct derived : public base {
BP> int f();
BP> };
BP> derived a ;
BP> a.f(1,2) ; // ERROR
BP> [Redefining] f() and inheriting parent's f(int,int) without
BP> additional problems would be [more] intuitive, and make no more
BP> work to the compiler.
Yes it would. It would complicate name lookup enormously, since it would
have to perform overload resolution across multiple scopes simultaneously.
As the current language rules stand, name lookup occurs first, finding the
`f' in the scope of class derived, and *then* overload resolution occurs, in
the scope of the name that is found.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|