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

提供: yonewiki
移動: 案内, 検索
(クラス const)
(クラス const)
113行: 113行:
 
CConst001::~CConst001(void)
 
CConst001::~CConst001(void)
 
{
 
{
 +
}
 +
 +
</syntaxhighlight>
 +
sample_main.cpp
 +
<syntaxhighlight lang="cpp" line start="1">
 +
#include "stdafx.h"
 +
#include "Const001.h"
 +
 +
int _tmain(int argc, _TCHAR* argv[])
 +
{
 +
  CConst001* CConst001_Instance = new CConst001;
 +
  CConst001_Instance->mfpub_Set_m_nValue(1000);
 +
  //CConst001_Instance->mpub_constnValue = 1000;★constメンバ変数の呼び出しは出来ない。
 +
 +
  const CConst001* CConst001_constInstance = new CConst001;
 +
  CConst001_constInstance->mfpubconst_Get_m_nValue();
 +
  //CConst001_constInstance->mfpub_Get_m_nValue();★const メンバ関数でないと呼べない。
 +
 +
  return 0;
 
}
 
}
  
 
</syntaxhighlight>
 
</syntaxhighlight>

2015年5月12日 (火) 00:00時点における版



個人用ツール
名前空間

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