public class Base
{
public bool Foo()
{
return true;
}
}
public class Derived : Base
{
public new void Foo() { }
public static void Main()
{
Base obj = new Derived();
bool foo = obj.Foo();
}
}
??????? ?? obj ? ???????? Inline variable. ??? ?????????, ?????????? ?? ??? ????? ? ????????? ?? ?????????????:
public static void Main()
{
bool foo = new Derived().Foo(); /* Cannot convert 'void' to 'bool' */
}
? ??????? ???:
public static void Main()
{
bool foo = ((Base) new Derived()).Foo();
}