Why can't I cast a base class to a derived class? Also, why doesn't the compiler catch this?
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Parent p = new Parent();
Child c = (Child)p;
}
}
class Parent
{
public string Data { get; set; }
}
class Child : Parent
{
public string OtherDate { get; set; }
}
}