2015年11月9日 星期一

C8_1 Scholar.cs 學者類別

using System;
namespace C8_1
{
    ///
    ///定義Person 類別的衍生類別 Scholar
    ///
    public abstract class Scholar : Person
    {
        private string s_aname;
        ///
        ///自訂義Scholar 類別的建構子
        ///
        ///
        public Scholar(string name, int age, float height, float weight, string sex, string aname)
            : base(name, age, height, weight, sex)
        //使用base關鍵字來顯式調用Person類別的建構子
        {
            aname = s_aname;
        }
        public Scholar()
        {

        }
        ///
        ///定義屬性
        ///
        public string Aname
        {
            get
            {
                return s_aname;
            }
            set
            {
                if (s_aname != value)
                {
                    s_aname = value;
                }
            }
        }
       // static void Main() { }
    }
}

沒有留言: