我想调用 FamilyCar 方法 Move()。如果 FamilyCar 是 LandVehicle,我想同时调用 LandVehicle Move() 方法。我正在寻找非常基本的方法来做到这一点。
基类
class LandVehicle : Vehicle
{
public override string Move()
{
return "Move on the wheels";
}
}
Run Code Online (Sandbox Code Playgroud)
子类
class FamilyCar : LandVehicle
{
public override string Move()
{
return "Pip pip!";
}
}
Run Code Online (Sandbox Code Playgroud)