//PROJECT: Project for function overloading study, designing for 08 C++ experiments.
//DATE: 2009.4.5
//AUTHOR: HHTecShare
//REMARKS: This program is used to show the influence of key words "const" on function overloading.
#include <iostream>
using namespace std;
//void constTest_1(int); //prototype of an overloading function with an integer parameter
//void constTest_1(const int); //prototype of an overloading function with a const integer parameter
void constTest_2(const int &); //prototype of an overloading function with a const integer reference parameter
void constTest_2(int &); //prototype of an overloading function with a non-const integer reference parameter
void constTest_3(const int &); //prototype of an overloading function with a const integer reference parameter
void constTest_4(int &); //prototype of an overloading function with a non-const integer reference parameter
void constTest_5(const int *); //prototype of an overloading function with a const integer pointer parameter
void constTest_5(int *); //prototype of an overloading function with a non-const integer pointer parameter
void constTest_6(const int *); //prototype of an overloading function with a const integer pointer parameter
void constTest_7(int *); //prototype of an overloading function with a non-const integer pointer parameter
int main()
{
int arg = 0; //an integer that will be used as an argument
const int constArg = 0; //a const integer that will be used as an argument
constTest_2(arg); //invoking with a non-const integer argument
constTest_2(constArg); //invoking with a const integer argument
constTest_3(arg); //invoking with a non-const integer argument
//constTest_4(constArg); //invoking with a const integer argument
constTest_5(&arg); //invoking with a pointer to a non-const integer argument
constTest_5(&constArg); //invoking with a pointer to a const integer argument
constTest_6(&arg); //invoking with a a pointer to a non-const integer argument
//constTest_7(&constArg); //invoking with a a pointer to a const integer argument
return 0;
}
//void constTest_1(int)
//{
// cout << "Function \"constTest_1(int)\" is called." << endl;
//}
//
//void constTest_1(const int)
//{
// cout << "Function \"constTest_1(const int)\" is called." << endl;
//}
void constTest_2(const int &arg)
{
cout << "Function \"constTest_2(const int &)\" is called." << endl;
}
void constTest_2(int &arg)
{
cout << "Function \"constTest_2(int &)\" is called." << endl;
}
void constTest_3(const int &arg)
{
cout << "Function \"constTest_3(const int &)\" is called." << endl;
}
void constTest_4(int &arg)
{
cout << "Function \"constTest_4(int &)\" is called." << endl;
}
void constTest_5(const int *argPtr)
{
cout << "Function \"constTest_5(const int *)\" is called." << endl;
}
void constTest_5(int *argPtr)
{
cout << "Function \"constTest_5(int *)\" is called." << endl;
}
void constTest_6(const int *argPtr)
{
cout << "Function \"constTest_6(const int *)\" is called." << endl;
}
void constTest_7(int *argPtr)
{
cout << "Function \"constTest_7(int *)\" is called." << endl;
}
没有合适的资源?快使用搜索试试~ 我知道了~
Function_Overloading_Illustration.rar_C Builder
共5个文件
cpp:3个
exe:1个
o:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 4 浏览量
2022-09-20
15:38:58
上传
评论
收藏 117KB RAR 举报
温馨提示
C++: 函数重载
资源推荐
资源详情
资源评论
收起资源包目录
Function_Overloading_Illustration.rar (5个子文件)
Function Overloading Illustration
ScopingRules.cpp 1KB
ConstKeyWords.exe 478KB
ConstKeyWords.o 3KB
ConstKeyWords.cpp 3KB
Enumeration.cpp 2KB
共 5 条
- 1
资源评论
四散
- 粉丝: 49
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- Docker在Ubuntu16.04上安装和部署Apache Storm
- test_kong.zip
- springboot权限验证学习-下
- SeetaFace6人脸质量评估C++代码实现Demo
- OCAuxiliaryTools
- 制药公司QC顶岗实习专题报告
- Rust 全面指南:从基础到高级,一网打尽 Rust 的编程知识
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功