Cpp クラス 継承 新しいページはコチラ

提供: yonewiki
移動: 案内, 検索
(クラス 継承)
(クラス 継承)
29行: 29行:
  
 
class CBaseInheritance{
 
class CBaseInheritance{
private:
+
protected:
 
     int m_iBaseMoney;
 
     int m_iBaseMoney;
 
     int m_iBaseMonth;
 
     int m_iBaseMonth;
 
     void CBaseInheritance(int iArgBaseMoney, int iArgBaseMonth);
 
     void CBaseInheritance(int iArgBaseMoney, int iArgBaseMonth);
 
     void ~CBaseInheritance();
 
     void ~CBaseInheritance();
 +
private:
 +
    void m_fvBaseDispValue();
 
public:
 
public:
    void m_fvDispValue();
 
 
     int m_fiBaseSumMoney();
 
     int m_fiBaseSumMoney();
 
};
 
};
 
#endif
 
#endif
 
</syntaxhighlight2>
 
</syntaxhighlight2>
 +
 +
 
<span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>BaseInheritance.cpp<span>)</span><!-- padding 上 右 下 左-->
 
<span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>BaseInheritance.cpp<span>)</span><!-- padding 上 右 下 左-->
 
<syntaxhighlight2 lang="cpp" line>
 
<syntaxhighlight2 lang="cpp" line>
53行: 56行:
 
     printf("Destructor:~CBaseInheritance\n");
 
     printf("Destructor:~CBaseInheritance\n");
 
}
 
}
void CBaseInheritance::m_fvDispValue(){
+
void CBaseInheritance::m_fvBaseDispValue(){
 
     printf("Money=%d\n" ,m_iBaseMoney * m_iBaseMonth);
 
     printf("Money=%d\n" ,m_iBaseMoney * m_iBaseMonth);
 
}
 
}
81行: 84行:
  
 
 でも、勉強だし、簡単なので、やってみましょう。 
 
 でも、勉強だし、簡単なので、やってみましょう。 
 +
 +
<span style="color: #ffffff; background-color: #555555; padding: 0px 5px 0px 5px; display: inline-block;">cpp <span>(</span>DeriveInheritance.h<span>)</span><!-- padding 上 右 下 左-->
 +
<syntaxhighlight2 lang="cpp" line>
 +
#ifndif __DERIVEINHERITANCE_H_YONET__
 +
#defint __DERIVEINHERITANCE_H_YONET__
 +
#if _MSC_VER > 1000
 +
#pragma once
 +
#endif
 +
 +
class CDeriveInheritance::CBaseInheritance{
 +
private:
 +
    int m_iDeriveMoney;
 +
    void CDeriveInheritance(int iArgDeriveMoney, int iArgDeriveMonth);
 +
    void ~CDeriveInheritance();
 +
public:
 +
    void m_fvDispValue();
 +
    int m_fiDeriveSumMoney();
 +
};
 +
#endif
 +
</syntaxhighlight2>
 +
 +
  
  

2020年7月13日 (月) 00:00時点における版



個人用ツール
名前空間

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