110,546
社区成员
发帖
与我相关
我的任务
分享
public class Father
{
private string _id;
public string Id
{
get { return _id; }
set { _id = value; }
}
}
public class Son1 : Father
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
}
public class Son2 : Father
{
private int _width;
public int Width
{
get { return _width; }
set { _width = value; }
}
}
public class TestClass
{
public void Test()
{
Father son1 = new Son1();
Father son2 = new Son2();
string son1_Id = son1.Id;
string son2_id = son2.Id;
string son1_Name = ((Son1)son1).Name;
Son2 son2xxxx = son2 as Son2;
int width = son2xxxx.Width;
}
}