025 类继承及成员访问限制
继承
- 继承系统 所有类隐式继承Object,继承链顶端
- 子类的实例也是父类的实例
namespace HelloOOP
{
internal class Program
{
static void Main(string[] args)
{
Vehicle vehicle = new Car();
Object o1 = new Vehicle();
Object o2 = new Car();
}
}
class Vehicle
{
}
class Car:Vehicle
{
<