using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
Chinese ch = new Chinese("王五", 12);
ch.SayHello();
}
public class Person
{
public string pname { get; set; }
public int page { get; set; }
public Person(string name, int age)
{
pname = name;
page = age;
}
public void SayHello()
{
Console.WriteLine("我是{0},我的年龄是:{1}", pname, page);
Console.ReadKey();
}
}
public class Chinese : Person
{
public Chinese(string cname, int cage)
: base(cname, cage)
{
page = cage;
pname = cname;
}
}
}
}
这是我写的,你看看和你的有什么样的差别 |