ユーザ用ツール

サイト用ツール


programming:継承時のコンストラクタ呼び出し

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
programming:継承時のコンストラクタ呼び出し [2017/08/09 04:43] dotprogramming:継承時のコンストラクタ呼び出し [2017/08/09 04:48] (現在) dot
行 1: 行 1:
 +
 +====== 実行結果 ======
 +
 +<code sh>
 +$ dotnet run
 +This is SuperClassSample Constructor.Argument is 1234
 +This is ChildClassSample Constructor.
 +</code>
 +
 +====== ソース ======
  
  
行 26: 行 36:
     {     {
         // we need "base(some integer variable)" because compiler can not know how to call SuperClass Constructor.         // we need "base(some integer variable)" because compiler can not know how to call SuperClass Constructor.
-        public ChildClassSample() : base(1)+        public ChildClassSample() : base(1234)
         {         {
             Console.WriteLine("This is ChildClassSample Constructor.");             Console.WriteLine("This is ChildClassSample Constructor.");
行 34: 行 44:
 </file> </file>
  
-<code sh> +
-$ dotnet run +
-This is SuperClassSample Constructor.Argument is 1 +
-This is ChildClassSample Constructor. +
-</code>+
programming/継承時のコンストラクタ呼び出し.1502253819.txt.gz · 最終更新: 2017/08/09 04:43 by dot