C# 里氏转换
//里氏转换 子类可以赋值给父类,如果有需要一个父类作为参数,可以使用子类作为代替
//Person p = new Student();
//如果父类中装的是子类对象,可以将父类强制类型转换为子类
//Student s = (Student)p;
// is如果转换成功,返回true,负责返回false
Person p = new Student("彭于晏", 18, "男",666);
//if (p is Student)
//{
// student s = (Student)p;
// s.showStudent();
//}
//else
//{
// Console.WriteLine("转换失败");
//}
//as 如果能转换,则返回对应的对象,佛则返回null
//Student s = p as Student;
//s.showStudent();