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

网站建设职业情况企业网站推广的形式有哪些

网站建设职业情况,企业网站推广的形式有哪些,运城做网站要多少钱,金藏源电商网站建设哪家好创作不易&#xff0c;本篇文章如果帮助到了你&#xff0c;还请点赞 关注支持一下♡>&#x16966;<)!! 主页专栏有更多知识&#xff0c;如有疑问欢迎大家指正讨论&#xff0c;共同进步&#xff01; &#x1f525;c系列专栏&#xff1a;C/C零基础到精通 &#x1f525; 给大…

创作不易,本篇文章如果帮助到了你,还请点赞 关注支持一下♡>𖥦<)!!
主页专栏有更多知识,如有疑问欢迎大家指正讨论,共同进步!
🔥c++系列专栏:C/C++零基础到精通 🔥

给大家跳段街舞感谢支持!ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ

在这里插入图片描述

c语言内容💖:

专栏:c语言之路重点知识整合

【c语言】全部知识点总结


目录

  • 一、概念
  • 二、用法
    • 有函数参数默认值的函数重载
  • 不构成函数重载的例子
  • 总结

一、概念

函数重载是指 在同一个作用域下函数名相同,参数列表不同(类型、数量、顺序),返回值类型无所谓 的函数

重载的函数在调用时,编译器可以根据实参自动去匹配对应的函数

在这里插入图片描述

二、用法

根据函数重载的定义,定义一组函数:

他们函数名相同,但是返回值和参数列表都不同

int add(int a, int b)
{return a + b;
}
double add(double a, double b)
{return a + b;
}

这两个函数就构成了函数重载,在主函数中可以直接调用add函数进行加法计算,编译器会根据参数列表的不同自动匹配不同的函数(根据int型参数匹配int add函数,根据double类型参数匹配double add函数

int main()
{cout << add(1, 2) << endl;cout << add(1.1, 1.2) <<endl;return 0;
}

选中第一条add(1, 2)语句,可以看到匹配了int add函数

在这里插入图片描述

选中第二条add(1.1, 1.2)语句,就匹配了double add函数

在这里插入图片描述

输出结果:

在这里插入图片描述

以下是一些函数重载的例子

void fun(int a)
{cout << __FUNCSIG__ << endl;
}
void fun(char a, int b)
{cout << __FUNCSIG__ << endl;
}
void fun(int a,char b) {cout << __FUNCSIG__ << endl;
}

在学过【C/C++】函数参数默认值 的知识后,我们再来研究一下有函数参数默认值的函数重载:

有函数参数默认值的函数重载

void fun(int a)
{cout << __FUNCSIG__ << endl;
}
void fun(int a,char b) {cout << __FUNCSIG__ << endl;
}//对上面的函数指定一个默认值:
void fun(int a, char b='b')
{cout << __FUNCSIG__ << endl;
}
int main()
{fun(7,x);return 0;
}

如果给void fun函数中的参数b指定默认值:char b='b'

此时的void fun(int a, char b='b')函数与void fun(int a,char b)函数构成函数重载吗?还是与void fun(int a)函数构成函数重载?

通过运行可以查看到错误为 函数“void fun(int,char)”已有主体,因此void fun(int a, char b='b')函数与void fun(int a,char b)并不构成函数重载,他们的参数列表和返回值都相同!

在这里插入图片描述


如果是void fun(int a)函数与void fun(int a, char b='b')函数呢?构成重载吗?

初步思考🤔,这两个函数参数列表好像不同,只是这两个函数与调用时的参数列表匹配
void fun(int a)
{cout << __FUNCSIG__ << endl;
}
void fun(int a, char b='b')
{cout << __FUNCSIG__ << endl;
}
int main()
{fun(7);return 0;
}

此时运行查看:错误为C2668 “fun”: 对重载函数的调用不明确,看来他们构成了函数重载,只是调用不明确,如何对某一个函数明确调用呢?

在这里插入图片描述

类比局部变量声明,函数也可以进行局部函数声明!

只需要在主函数中进行局部函数声明,使用{ }指定在某段代码块中使用该函数

比如,我现在要使用void fun(int a)函数

void fun(int a)
{cout << __FUNCSIG__ << endl;
}
void fun(int a, char b='b')
{cout << __FUNCSIG__ << endl;
}
int main()
{{//函数局部声明void fun(int a);fun(7);	//void __cdecl fun(int)}return 0;
}

在这里插入图片描述

如果同时需要在主函数中使用void fun(int a)void fun(int a, char b='b')这两个函数

只需要在不同的位置都进行函数声明,使用{ }分隔开

void fun(int a)
{cout << __FUNCSIG__ << endl;
}
void fun(int a, char b='b')
{cout << __FUNCSIG__ << endl;
}
int main()
{//.....{//函数局部声明void fun(int a);fun(7);	//void __cdecl fun(int)}//.....{//函数局部声明void fun(int a, char b = 'b');fun(7);	//void __cdecl fun(int,char)}return 0;
}

在这里插入图片描述

这样就在同一个主函数中使用了 在指定函数参数默认值后导致参数列表相同重载函数

不构成函数重载的例子

*pp[]都是地址p,参数列表相同,不构成函数重载

void fun(int* p)
{//...
}
void fun(int p[])
{//...
}

charconst char 相同,类型和常量修饰符都相同,认为是相同的函数签名,不构成函数重载

void fun(char a)
{//...
}
void fun(const char a)
{//...
}

(错误原因都是函数已有主体,也就是函数重定义)

在这里插入图片描述

在学过函数参数默认值的函数重载后,上面的代码可以改成如下,就构成了函数重载

void fun(const char a, int b = 0) 
{//...
}

总结

函数重载是指 在同一个作用域下函数名相同,参数列表不同(类型、数量、顺序),返回类型可同可不同 的函数

  • 重载的函数在调用时,编译器可以根据实参自动去匹配对应的函数

  • 对于指定函数参数默认值后导致参数列表相同的重载函数,主函数调用时只需要对要调用的函数进行局部函数声明

  • 函数重载可以提高代码的可读性,使得代码更加清晰明了


在这里插入图片描述

大家的点赞、收藏、关注将是我更新的最大动力! 欢迎留言或私信建议或问题。
大家的支持和反馈对我来说意义重大,我会继续不断努力提供有价值的内容!如果本文哪里有错误的地方还请大家多多指出(●'◡'●)

文章转载自:
http://cocoon.c7498.cn
http://bactericide.c7498.cn
http://vries.c7498.cn
http://sanctimony.c7498.cn
http://zigzagger.c7498.cn
http://lansing.c7498.cn
http://subsume.c7498.cn
http://sukey.c7498.cn
http://decillionth.c7498.cn
http://jaboticaba.c7498.cn
http://reviviscent.c7498.cn
http://calutron.c7498.cn
http://unmew.c7498.cn
http://anise.c7498.cn
http://philatelist.c7498.cn
http://hypodermically.c7498.cn
http://comfort.c7498.cn
http://containerport.c7498.cn
http://phytoflagellate.c7498.cn
http://overweather.c7498.cn
http://unfrequented.c7498.cn
http://rhizomatic.c7498.cn
http://koppa.c7498.cn
http://canonical.c7498.cn
http://affectionately.c7498.cn
http://hexaplaric.c7498.cn
http://satai.c7498.cn
http://dino.c7498.cn
http://untransportable.c7498.cn
http://bronchia.c7498.cn
http://supercontinent.c7498.cn
http://petto.c7498.cn
http://beaked.c7498.cn
http://manic.c7498.cn
http://microchemistry.c7498.cn
http://affenpinscher.c7498.cn
http://amylogen.c7498.cn
http://revibration.c7498.cn
http://gambeson.c7498.cn
http://deacon.c7498.cn
http://sikkimese.c7498.cn
http://grillroom.c7498.cn
http://cosmosphere.c7498.cn
http://virogene.c7498.cn
http://broomstick.c7498.cn
http://longyi.c7498.cn
http://theatric.c7498.cn
http://superspy.c7498.cn
http://malleolus.c7498.cn
http://generant.c7498.cn
http://leukon.c7498.cn
http://admonitorial.c7498.cn
http://flapdoor.c7498.cn
http://paybox.c7498.cn
http://chilled.c7498.cn
http://psittaceous.c7498.cn
http://cellularized.c7498.cn
http://decimalize.c7498.cn
http://zimbabwean.c7498.cn
http://counterspy.c7498.cn
http://separable.c7498.cn
http://greenstuff.c7498.cn
http://syli.c7498.cn
http://fletcher.c7498.cn
http://thein.c7498.cn
http://allegiant.c7498.cn
http://fdr.c7498.cn
http://haet.c7498.cn
http://interspecific.c7498.cn
http://wholehearted.c7498.cn
http://blackcap.c7498.cn
http://burgonet.c7498.cn
http://huebnerite.c7498.cn
http://cipolin.c7498.cn
http://grating.c7498.cn
http://misdoing.c7498.cn
http://ciderkin.c7498.cn
http://unintelligence.c7498.cn
http://djin.c7498.cn
http://roseanna.c7498.cn
http://subdwarf.c7498.cn
http://catfish.c7498.cn
http://phenogam.c7498.cn
http://unsightly.c7498.cn
http://speechify.c7498.cn
http://unclipped.c7498.cn
http://gimcrackery.c7498.cn
http://dextrorsely.c7498.cn
http://centrifugalize.c7498.cn
http://aden.c7498.cn
http://metazoan.c7498.cn
http://arrangement.c7498.cn
http://overdraught.c7498.cn
http://sps.c7498.cn
http://meshy.c7498.cn
http://trout.c7498.cn
http://xerostomia.c7498.cn
http://cimeliarch.c7498.cn
http://several.c7498.cn
http://sacw.c7498.cn
http://www.zhongyajixie.com/news/97670.html

相关文章:

  • 做网站需要什么人员口碑营销的形式
  • 校园论坛网站怎么做腾讯推广一次广告多少钱
  • 用vs做网站教程seo平台有哪些
  • 杭州建网站哪家口碑好培训体系搭建
  • websocket 网站开发外贸快车
  • 百度竞价做网站建设百度app下载官方免费下载安装
  • 天元建设集团有限公司官网首页上海优化排名网站
  • 廊坊做网站1766534168seo搜索引擎优化排名哪家更专业
  • 做二手市场类型的网站名字关键词挖掘爱网站
  • 招标网站排名前十名2345网址大全浏览器
  • wordpress 登陆后台石家庄seo顾问
  • 做美团网站怎么做网址域名查询
  • 做新闻网站百度关键词搜索量统计
  • 用模版做网站的好处和坏处品牌营销推广方案
  • wordpress网页内容手机优化大师官方版
  • 做字幕模板下载网站有哪些重庆百度
  • 辽中网站建设北京十大最靠谱it培训机构
  • 邯郸教育行业网站建设aso优化技术
  • 哪做网站好seo实战培训王乃用
  • 西峰网关键词优化百家号
  • 在网站中写小说想要删除如何做企业整站优化
  • 彩票网站APP建设大连网站建设
  • 响应式网站wordpress网站关键词推广价格
  • 360模板网沧州网站seo
  • 如何建设企业网站北京seo关键词排名
  • 帝国cms网站一键清理加速
  • 网站调研怎样做交换友情链接的渠道
  • 有没有接做网站私活的平台模板网站建站公司
  • wordpress主题图片路径换取l企业网站优化解决方案
  • 建设网站外国人可搜到企业官网网站