G
Guest
Is it possible to force a cast to an inherited class?
class Program
{
static void Main(string [] args)
{
Father Dad = new Father( );
Son boy = (Son) Dad; // <<== fails at run time with
invalid cast
}
class Father { }
class Son : Father { }
}
Is there any way to allow the son to follow in his father's footsteps...
class Program
{
static void Main(string [] args)
{
Father Dad = new Father( );
Son boy = (Son) Dad; // <<== fails at run time with
invalid cast
}
class Father { }
class Son : Father { }
}
Is there any way to allow the son to follow in his father's footsteps...