public interface IGame
{
public string Name{get;set;}
public void Run();
}
public class CS: IGame
{
public string Name{get;set;} = "Conter-Strike";
public void Run()
{
Console.WriteLine($"{this.Name} - RUN!")
}
}
public class Dota: IGame
{
public string Name{get;set;} = "Dota-2";
public void Run()
{
Console.WriteLine($"{this.Name} - RUN!")
}
}
public enum GameTypeEnum {
CS=1,
Dota=2
}
public static void Main(GameTypeEnum gameTypeEnum ){
IGame currentGame;
switch(gameTypeEnum ){
case CS:
currentGame = new CS();
break;
case Dota:
currentGame = new Dota();
break;
}
currentGame.Run();
}