47 lines
875 B
C#
47 lines
875 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FactoryPattern.Samples
|
|
{
|
|
public interface IVehicle
|
|
{
|
|
string VehicleType { get; set; }
|
|
|
|
string Start();
|
|
}
|
|
|
|
public class Car : IVehicle
|
|
{
|
|
public string VehicleType { get; set; } = "Car";
|
|
|
|
public string Start()
|
|
{
|
|
return "The Car has been Started.";
|
|
}
|
|
}
|
|
|
|
public class Van : IVehicle
|
|
{
|
|
public string VehicleType { get; set; } = "Van";
|
|
|
|
public string Start()
|
|
{
|
|
return "The Van has been Started.";
|
|
}
|
|
}
|
|
|
|
public class Truck : IVehicle
|
|
{
|
|
public string VehicleType { get; set; } = "Truck";
|
|
|
|
public string Start()
|
|
{
|
|
return "The Truck has been Started.";
|
|
}
|
|
}
|
|
|
|
}
|