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版本 请按任意键继续. . . ---------------------------------*/
相关文章推荐
- const与非const参数调用重载函数
- 函数传递const和非const非引用参数的笔记 - 20150905
- 【转载】用const修饰函数 以及引起的附加限制:const函数不能调用非const的函数或引用非const参数
- 关于const对象和非const对象在函数参数传递式的规则
- 函数参数之 传常引用(passed by reference to const)替换 传值(passed by value)
- C语言中函数的参数列表为空和void的区别
- CString参数用于const void*的理解
- [c++11]如果函数不修改传入的参数,则参数添加const 修饰 -- rvalue
- 函数参数中const 引用 和 传值
- 函数参数列表为空和void的区别
- const 修饰函数参数,返回值,函数体
- Delphi 中 函数参数中的 const 修饰符的本质以及注意事项
- 总结函数的参数,指针参数及const修饰的情况
- 学习笔记 C++ const放在函数体前和函数参数列表之后的作用
- 编写函数 void dollars(char *dest,char const *src)
- c++ const: const 变量, const 输入参数, const 返回值, const 成员函数
- 为什么不能够 向接受 const char ** 参数的函数,传入 char ** 参数?
- const函数参数优点
- php5.6及其以上版本有了新特性,函数可以传入不定数目的参数
- [C++] C++中const修饰指针,变量, 函数参数和函数返回值的用法总结