C# 超簡易Model繼承範例

C#

public class ModelA
{
    public int id { get; set; }
    public string name { get; set; }
}

public class ModelB : ModelA    //ModelB繼承了ModelA
{
    public int money { get; set; }
}

public void testFeature()
{
    ModelB test = new ModelB();
    test.id = 1;            //ModelB可以使用ModelA的方法
    test.name = "Tree";
    test.money = 99999;
}

我只是一棵樹