Cpp クラス 継承 アップキャスト 新しいページはコチラ

提供: yonewiki
移動: 案内, 検索
(クラス 継承 アップキャスト)
 
5行: 5行:
 
<tr>
 
<tr>
 
<td style="width:1px;"></td>
 
<td style="width:1px;"></td>
<td class="mbox-text plainlist" style="">本来の表記は「<b><span id="RealTitle" style="font-size:large;">C++ クラス 継承 アップキャスト</span></b>」です。この記事に付けられた題名は{{記事名の制約}}から不正確なものとなっています。</td>
+
<td class="mbox-text plainlist" style="">本来の表記は「<b><span id="RealTitle" style="font-size:large;">C++(Cpp) クラス 継承 アップキャスト</span></b>」です。この記事に付けられた題名は{{記事名の制約}}から不正確なものとなっています。</td>
 
</tr>
 
</tr>
 
</table>
 
</table>
92行: 92行:
 
void CBaseInheritance::mf_vDispValue() {
 
void CBaseInheritance::mf_vDispValue() {
 
     int iSumMoney = mf_iBaseSumMoney();
 
     int iSumMoney = mf_iBaseSumMoney();
     printf("BaseMoney=%d\n", iSumMoney);
+
     printf("BaseMoney=%d total=%d\n", iSumMoney, m_iMoney);
 
}
 
}
  
147行: 147行:
 
 
 
m_iDeriveOption = iArgOption;
 
m_iDeriveOption = iArgOption;
 +
        m_iMoney = mf_iBaseSumMoney() + m_iDeriveOption;
 
}
 
}
  
348行: 349行:
 
   
 
   
 
     CBaseInheritance objCBaseInheritance(3900, 12);
 
     CBaseInheritance objCBaseInheritance(3900, 12);
     objCBaseInheritance.mf_vBaseDispValue();
+
     objCBaseInheritance.mf_vDispValue();
  
 
     CDeriveInheritance objCDeriveInheritance2Arg(2900, 12);
 
     CDeriveInheritance objCDeriveInheritance2Arg(2900, 12);
 
     objCDeriveInheritance2Arg.mf_vDeriveSetOptionValue(600);
 
     objCDeriveInheritance2Arg.mf_vDeriveSetOptionValue(600);
     objCDeriveInheritance2Arg.mf_vDeriveDispValue();
+
     objCDeriveInheritance2Arg.mf_vDispValue();
  
 
     CDeriveInheritance objCDeriveInheritance3Arg(2900, 12, 600);
 
     CDeriveInheritance objCDeriveInheritance3Arg(2900, 12, 600);
     objCDeriveInheritance3Arg.mf_vDeriveDispValue();
+
     objCDeriveInheritance3Arg.mf_vDispValue();
  
 
     int piOptionArr[] = { 300, 500, 400, 390 };
 
     int piOptionArr[] = { 300, 500, 400, 390 };
 
     int iSize = (int)(sizeof piOptionArr / sizeof(*piOptionArr));
 
     int iSize = (int)(sizeof piOptionArr / sizeof(*piOptionArr));
 
     CDeriveArrInheritance objCDeriveArrInheritance(3900, 12, piOptionArr, iSize);
 
     CDeriveArrInheritance objCDeriveArrInheritance(3900, 12, piOptionArr, iSize);
     objCDeriveArrInheritance.mf_vDeriveArrDispValue();
+
     objCDeriveArrInheritance.mf_vDispValue()();
  
 
     CDeriveDiscountInheritance objCDeriveDiscountInheritance(3900, 12, 0.5);
 
     CDeriveDiscountInheritance objCDeriveDiscountInheritance(3900, 12, 0.5);
     objCDeriveDiscountInheritance.mf_vDeriveDiscountDispValue();
+
     objCDeriveDiscountInheritance.mf_vDispValue();
  
 
     return 0;
 
     return 0;
375行: 376行:
 
<syntaxhighlight2 lang="text" line start=900>
 
<syntaxhighlight2 lang="text" line start=900>
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
BaseMoney=46800
+
BaseMoney=46800, total=35700
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CDriveInheritance(int,int)
 
Constructor:CDriveInheritance(int,int)
DeriveMoney=35400
+
BaseMoney=34800, total=35700
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructer:CDeriveInheritance(int,int,int)
 
Constructer:CDeriveInheritance(int,int,int)
DeriveMoney=35400
+
BaseMoney=34800, total=35700
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructer:CDeriveArrInheritance(int,int,int*,int)
 
Constructer:CDeriveArrInheritance(int,int,int*,int)
DeriveMoney=48390
+
BaseMoney=46800, total=48390
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructer:CDeriveDiscountInheritance(int,int,double)
 
Constructer:CDeriveDiscountInheritance(int,int,double)
DeriveMoney=23400
+
BaseMoney=46800, total=23400
 
Destructer:~CDeriveDiscountInheritance()
 
Destructer:~CDeriveDiscountInheritance()
 
Destructor:~CBaseInheritance()
 
Destructor:~CBaseInheritance()
429行: 430行:
 
     CBaseInheritance* pCBaseInheritanceUpcast;
 
     CBaseInheritance* pCBaseInheritanceUpcast;
 
     pCBaseInheritanceUpcast = pCBaseInheritanceUpcastF(1);
 
     pCBaseInheritanceUpcast = pCBaseInheritanceUpcastF(1);
     pCBaseInheritanceUpcast->mf_vBaseDispValue();
+
     pCBaseInheritanceUpcast->mf_vDispValue();
 
     pCBaseInheritanceUpcast = pCBaseInheritanceUpcastF(2);
 
     pCBaseInheritanceUpcast = pCBaseInheritanceUpcastF(2);
     pCBaseInheritanceUpcast->mf_vBaseDispValue();
+
     pCBaseInheritanceUpcast->mf_vDispValue();
 
     pCBaseInheritanceUpcast = pCBaseInheritanceUpcastF(3);
 
     pCBaseInheritanceUpcast = pCBaseInheritanceUpcastF(3);
     pCBaseInheritanceUpcast->mf_vBaseDispValue();
+
     pCBaseInheritanceUpcast->mf_vDispValue();
 
     delete pCBaseInheritanceUpcast;
 
     delete pCBaseInheritanceUpcast;
  
451行: 452行:
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CDriveInheritance(int,int)
 
Constructor:CDriveInheritance(int,int)
BaseMoney=34800
+
BaseMoney=34800, total=35700
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructer:CDeriveArrInheritance(int,int,int*,int)
 
Constructer:CDeriveArrInheritance(int,int,int*,int)
BaseMoney=34800
+
BaseMoney=34800, total=36520
 
Constructor:CBaseInheritance(int,int)
 
Constructor:CBaseInheritance(int,int)
 
Constructer:CDeriveDiscountInheritance(int,int,double)
 
Constructer:CDeriveDiscountInheritance(int,int,double)
BaseMoney=46800
+
BaseMoney=46800, total=23400
 
Destructor:~CBaseInheritance()
 
Destructor:~CBaseInheritance()
 
</syntaxhighlight2>
 
</syntaxhighlight2>

2021年2月6日 (土) 00:00時点における最新版



個人用ツール
名前空間

変種
操作
案内
ツールボックス