C#基礎與技巧——類與里氏替換

繼承 public class Person{}; Public class student:Person{}; person這個類叫父類(基類),student這個類叫子類(派生類) student繼承了person類 person類派生了student類 類中的構造函數問題   子類中的構造函數會自動的調用父類中無參的構造函數,因此若是父類中寫了有參的構造函數,必須再單獨寫無參的構造函數。
相關文章
相關標籤/搜索