C#中内部类的实现
//内部定义类使用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConTest
{
class Cow
{
private string name;
public class Chicken
{
private int foots;
public int Foots
{
get { return foots; }
set { foots = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public Chicken()
{
}
public Chicken(string name,int foots)
{
this.name = name;
this.foots = foots;
}
public void Move()
{
Console.Write("Chicken Move");
}
}
public void ShowMsgAboutChicken()
{
Chicken chicken = new Chicken("黄花鸡", 3);
Console.WriteLine(chicken.Name + chicken.Foots);
}
}
class TestCow
{
public static void Main()
{
Cow cow = new Cow();
cow.ShowMsgAboutChicken();
Console.WriteLine("success");
Console.Read();
}
}
}