C#不是只允许单继承的,怎么可以可以这样继承的,搞不明白
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Person
{
class Program
{
public static void Main(String[] args)
{
Chinese c1 = new Chinese();
c1.name = "Tom";
c1.height = 170;
c1.weight = 55;
c1.speak("Tom",170,55);
c1.kongfu();
Korean k1 = new Korean();
k1.zhengrong();
Console.ReadKey();
}
}
class Person
{
public string name;
public int height;
public int weight;
public void speak(string name,int height,int weight)
{
Console.WriteLine("Hello,my name is {0},my height is {1}cm,weight is {2}kg.",name,height,weight);
}
}
class Chinese : Person
{
public void kongfu()
{
Console.WriteLine("我打,中国人不是东亚病夫!");
}
}
class Korean : Person
{
public void zhengrong()
{
Console.WriteLine("来,让我来帮你整容!");
}
}
}
//求大家帮忙解答下,我对继承真的不怎么明白。