public static void Main()
IHorn h = new BawoogaHorn();
IVehicle v = new MonsterTruck();
Car c = new Car(v, h, "My new Truck");
Console.WriteLine(c.Honk());
Console.WriteLine(c.GetLength());
public IVehicle Vehicle {get;set;}
public IHorn Horn{get;set;}
public string Name { get; set; }
public Car(IVehicle vehicleType, IHorn horn, string name)
this.Vehicle = vehicleType;
public string GetLength()
return this.Vehicle.Length().ToString();
public interface IVehicle{
public class BawoogaHorn : IHorn
return "BAWWWWWWOOOOOOOOGA";
public class TinyHorn : IHorn{
public class MonsterTruck : IVehicle{
public string VehicleType()
public class SportTruck : IVehicle{
public string VehicleType()