一个继承的小程序
时间:2011-04-29 来源:scorpioying
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace jicheng
{
class club
{
public void method_HostTeam()
{
Console.Write("Host Team: ");
}
public void method_GuestTeam()
{
Console.Write("Guest Team: ");
}
public void method_Venues()
{
Console.Write("the venues of the match: ");
}
private string name_Host;
private string name_Guest;
private string name_Venues;
public string name_HostTeam
{
get
{
return this.name_Host;
}
set
{
this.name_Host = value;
}
}
public string name_GuestTeam
{
get
{
return this.name_Guest;
}
set
{
this.name_Guest = value;
}
}
public string name_venues
{
get
{
return this.name_Venues;
}
set
{
this.name_Venues = value;
}
}
public void getname_HostTeam()
{
Console.WriteLine(name_Host);
}
public void getname_GuestTeam()
{
Console.WriteLine(name_Guest);
}
public void getname_venues()
{
Console.WriteLine(name_Venues);
}
}
class First : club
{
public void method_HostTeam1()
{
base.method_HostTeam();
}
public void method_GuestTeam1()
{
base.method_GuestTeam();
}
public void method_Venues1()
{
base.method_Venues();
}
public string name_HostTeam1
{
get
{
return base.name_HostTeam;
}
set
{
base.name_HostTeam = value;
}
}
public string name_GuestTeam1
{
get
{
return base.name_GuestTeam;
}
set
{
base.name_GuestTeam = value;
}
}
public string name_venues1
{
get
{
return base.name_venues;
}
set
{
base.name_venues = value;
}
}
}
class second : club
{
public void method_HostTeam2()
{
base.method_HostTeam();
}
public void method_GuestTeam2()
{
base.method_GuestTeam();
}
public void method_Venues2()
{
base.method_Venues();
}
public string name_HostTeam2
{
get
{
return base.name_HostTeam;
}
set
{
base.name_HostTeam = value;
}
}
public string name_GuestTeam2
{
get
{
return base.name_GuestTeam;
}
set
{
base.name_GuestTeam = value;
}
}
public string name_venues2
{
get
{
return base.name_venues;
}
set
{
base.name_venues = value;
}
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("英格兰超级联赛第34轮\n");
First club_1stHost = new First ();
club_1stHost.method_HostTeam1();
club_1stHost.name_HostTeam1 = "布莱克本";
club_1stHost.getname_HostTeam();
First club_1stGuest = new First();
club_1stGuest.method_GuestTeam1();
club_1stGuest.name_GuestTeam1 = "曼城";
club_1stGuest.getname_GuestTeam();
First venues1 = new First();
venues1.method_Venues();
venues1.name_venues1 = "古迪逊公园球场";
venues1.getname_venues();
Console.WriteLine("\n");
second club_2ndHost = new second();
club_2ndHost.method_HostTeam2();
club_2ndHost.name_HostTeam2 = "博尔顿";
club_2ndHost.getname_HostTeam();
second club_2ndGuest = new second();
club_2ndGuest.method_GuestTeam2();
club_2ndGuest.name_GuestTeam2 = "阿森纳";
club_2ndGuest.getname_GuestTeam();
second venues2 = new second();
venues2.method_Venues2();
venues2.name_venues2 = "锐步球场";
venues2.getname_venues();
}
}
}