animal.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace work100
{
public class Animal
{
public string type;
public string color;
public string sound;
}
public class people : Animal
{
public string country;
}
}
webform1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace work100
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
work100.Animal cat = new Animal();
cat.color = "黑身白面";
cat.type = "波斯猫";
cat.sound = "喵喵";
work100.people man = new people();
man.color = "黄色";
man.type = "日本鬼子";
man.sound = "八格牙路";
man.country = "日本";
}
}
}