//本人英语不太好,嘿嘿。。
//其实接口多继承和单继承的形式是一样的。
//博客里接口单继承,单继承会了,看这个就很轻松了
namespace 接口多继承
{
interface Love
{
//姓名
string Name { set; get; }
//年龄
string Age { get; set; }
}
interface Zhiye : Love
{
//职业
string Zy { set; get; }
}
interface Diqu : Love
{
//住址
string Dq { set; get; }
}
class Program : Zhiye, Diqu, Love
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string age;
public string Age
{
get { return age; }
set { age = value; }
}
private string dq;
public string Dq
{
get { return dq; }
set { dq = value; }
}
private string zy;
public string Zy
{
get { return zy; }
set { zy = value; }
}
public void rkdc()//人口调查
{
Console.WriteLine("姓名:" Name "t" "年龄:" Age
't' "职业:" Zy 't' "住址:" Dq);
}
public void lv()
{
string x = "↓";
int i = 0;
while(i!=13)
{
if (i == 6)
{
Console.WriteLine(x x x x x x x x x x x x x "我"
"爱" "你" x x x x x x x x x x x x x);
}
else
{
Console.WriteLine(x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x);
}
i ;
}
}
static void Main(string[] args)
{
Program p = new Program();
Program pp = new Program();
p.Name = "毕毕"; pp.Name = "丹丹";
p.Age = "23"; pp.Age = "22";
p.Zy = "程序员"; pp.Zy = "小学生";
p.Dq = "长春"; pp.Dq = "邯郸";
p.rkdc(); p.lv(); pp.rkdc();
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
本文由分分快三计划发布,转载请注明来源
关键词: 分分快三计划