Cpp クラス 継承 新しいページはコチラ
提供: yonewiki
(→クラス 継承) |
(→クラス 継承) |
||
45行: | 45行: | ||
<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> | ||
− | #include | + | #include <cstdio> |
− | #include " | + | #include "BaseInheritance.h" |
− | + | CBaseInheritance::CBaseInheritance(int iArgBaseMoney, int iArgBaseMonth) { | |
− | + | m_iBaseMoney = iArgBaseMoney; | |
m_iBaseMonth = iArgBaseMonth; | m_iBaseMonth = iArgBaseMonth; | ||
printf("Constructor:CBaseInheritance\n"); | printf("Constructor:CBaseInheritance\n"); | ||
} | } | ||
− | + | CBaseInheritance::~CBaseInheritance() { | |
printf("Destructor:~CBaseInheritance\n"); | printf("Destructor:~CBaseInheritance\n"); | ||
} | } | ||
− | void CBaseInheritance::m_fvBaseDispValue(){ | + | void CBaseInheritance::m_fvBaseDispValue() { |
− | printf("Money=%d\n" ,m_iBaseMoney * m_iBaseMonth); | + | printf("Money=%d\n", m_iBaseMoney * m_iBaseMonth); |
} | } | ||
− | int CBaseInheritance::m_fiBaseSumMoney(){ | + | int CBaseInheritance::m_fiBaseSumMoney() { |
return (m_iBaseMoney * m_iBaseMonth); | return (m_iBaseMoney * m_iBaseMonth); | ||
} | } |