On 5/30/2011 7:50 PM, Jacob Carlborg wrote:
On 2011-05-30 08:53, Kagamin wrote:
class Base
{
void foo(string s){}
}
class Derived: Base
{
alias Base.foo foo;
void foo(long s){}
}
So far so good.
Now add new method to the Base class.
class Base
{
void foo(string s){}
void foo(int s){}
}
Now behavior of the calling code silently changes.
Yes, but you've made an active choice by adding the alias.
alias assumes both the Base Class and Derived Class are coded by the
*same* person and within the *same* module.
What *if* that is *not* the case, I think Kagamin is trying to show that
*How* would the coder of the Derived be *notify* of this change *even*
when alias is used.
--
Matthew Ong
email: [email protected]