您的位置:首页 > 其它

void*参数函数的const和非const重载函数版本

2012-05-09 19:44 295 查看
#include <iostream>
using namespace std;

void func( void *p )
{
cout << "非const版本" << endl;
}

void func( const void *p )
{
cout << "const版本" << endl;
}

int main( void )
{
const int cpp = 2002;
func( &cpp );

int flash = 1500;
func( &flash );

system( "PAUSE" );
return EXIT_SUCCESS;
}

/*-------------------
const版本
非const版本
请按任意键继续. . .
---------------------------------*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: