public int MaxNumPlayers{get;set;}
public string Name{get;set;}
public virtual string ToString()
return "Maximum number of players for "+this.Name+" is "+this.MaxNumPlayers;
public class GameWithTimeLimit : Game
public new string ToString()
return base.ToString()+"\nTime Limit for "+base.Name+" is "+this.TimeLimit+" minutes";
public static void Main()
Game g = new GameWithTimeLimit();
Console.WriteLine("Enter a game");
g.Name=Console.ReadLine();
Console.WriteLine("Enter the maximum number of players");
g.MaxNumPlayers=Convert.ToInt32(Console.ReadLine());
Console.WriteLine(g.ToString());
GameWithTimeLimit g2=new GameWithTimeLimit();
Console.WriteLine("Enter a game that has time limit");
g2.Name=Console.ReadLine();
Console.WriteLine("Enter the maximum number of players");
g2.MaxNumPlayers=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the time limit in minutes");
g2.TimeLimit=Convert.ToInt32(Console.ReadLine());
Console.WriteLine(g2.ToString());