当前位置: 首页 > news >正文

做数据表格的网站冬镜seo

做数据表格的网站,冬镜seo,优购物官方网站手机,深圳做营销网站制作C系列-函数重载 函数重载函数重载的条件函数重载注意事项引用作为重载函数重载遇到默认参数 函数重载 函数名可以相同, 提高复用性 函数重载的条件 同一个作用域下函数名相同函数参数不同 – 参数个数不同 – 参数顺序不同 – 参数类型不同不可以使用返回值作为重…

C++系列-函数重载

  • 函数重载
    • 函数重载的条件
    • 函数重载注意事项
      • 引用作为重载
      • 函数重载遇到默认参数

函数重载

  • 函数名可以相同, 提高复用性

函数重载的条件

  • 同一个作用域下
  • 函数名相同
  • 函数参数不同
    – 参数个数不同
    – 参数顺序不同
    – 参数类型不同
  • 不可以使用返回值作为重载的条件
code:#include<iostream>using namespace std;void test(){cout << "void test()" << endl;}void test(int a){cout << "void test(int a)" << endl;}void test(int a, float b){cout << "void test(int a, float b)" << endl;}void test(float a, int b){cout << "void test(float a, int b)" << endl;}void main(){test();test(100);test(100, 3.14);test(3.14, 100);system("pause");}
result:void test()void test(int a)void test(int a, float b)void test(float a, int b)

函数重载注意事项

引用作为重载

  • 参数可以分为const和非const。
code:#include<iostream>using namespace std;void test(int &a){cout << "void test(int &a)" << endl;}void test(const int& a){cout << "void test(const int& a)" << endl;}void main(){int a = 10;test(a);test(10);		// 当执行void test(int &a) 则为int &a=10,会出错,const int& a=10,正常system("pause");}
result:
void test(int &a)
void test(const int& a)

函数重载遇到默认参数

code:
#include<iostream>
using namespace std;void test(int a, int b = 10)
{cout << "void test(int a, int b = 10)" << endl;
}
void test(int a)
{cout << "void test(int a)" << endl;
}void main()
{//test(666);		// 报错,不知道执行哪一个test(20, 30);system("pause");
}result:void test(int a, int b = 10)
http://www.dinnco.com/news/8753.html

相关文章:

  • 网站开发进度计划是什么国内新闻最新5条
  • 万网域名管理网站2021年十大热点事件
  • 企业为什么要做网络营销推广杭州seo推广优化公司
  • 企业酒店的网站建设站长统计软件
  • 如何用axure做网站搜索引擎案例分析结论
  • 我的世界怎么做的好看视频网站百度百家
  • 昆明网站做的好的公司太原搜索引擎优化
  • 在哪做网站建设百度推广费用一年多少钱
  • 专门做简历的网站河南百度推广公司
  • 销售机械设备做网站网站设计说明
  • 一个服务器可以备案几个网站百度推广深圳分公司
  • 网站建设 招聘百度搜索推广和信息流推广
  • wordpress 搭建网站长春网站建设团队
  • 烟台网站建设维护品牌策划公司
  • 做网站不用服务器吗免费的网站
  • 西部数据网站空间2021十大网络舆情案例
  • 精品网站开发公司上海网络推广专员
  • 建设企业网站可信度免费网站java源码大全
  • 上海专业网站建设案例网站网络推广运营
  • 网站建设阝金手指科杰十二展示型网站设计公司
  • 手工制作大全简单漂亮太原关键词排名优化
  • 廉价网站建设关键词优化的最佳方法
  • 网站开发成本主要有哪些百度搜索排名怎么收费
  • 大战网站建设谷歌ads
  • 石家庄网站开发与优化优化大师官网登录入口
  • 锡林浩特建设局网站百度云资源链接分享群组
  • 网站用什么软件编写网站怎么优化seo
  • dedecms网站后台管理系统做推广app赚钱的项目
  • 石家庄免费专业做网站百度荤seo公司
  • 东莞整合网站建设推广厦门网站推广费用