using System;
namespace POLYMORPHISM1
{
public class Program
{
static void Main(string[] args)
{
Vehicle vehicle = new Vehicle();
Vehicle vehicle1 = new Car();
Vehicle vehicle2 = new Truk();
vehicle.start();
vehicle.horn();
vehicle.stop();
vehicle1.start();
vehicle1.horn();
vehicle1.stop();
vehicle2.start();
vehicle2.horn();
vehicle2.stop();
Console.ReadLine();
}
}
public class Vehicle
{
public virtual void start() { Console.WriteLine("Vehicle Started"); }
public virtual void horn() { Console.WriteLine("Vehicle Horned"); }
public virtual void stop() { Console.WriteLine("Vehicle Stopped"); }
}
public class Car : Vehicle
{
public override void start() { Console.WriteLine("Car Started"); }
public override void horn() { Console.WriteLine("Car Horned"); }
public override void stop() { Console.WriteLine("Car Stopped"); }
}
public class Truk : Vehicle
{
public override void start() { Console.WriteLine("Truck Started"); }
public override void horn() { Console.WriteLine("Truck Horned"); }
public override void stop() { Console.WriteLine("Truck Stopped"); }
}
}