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

网站上点击图片局部放大如何做新塘网站seo优化

网站上点击图片局部放大如何做,新塘网站seo优化,党政网站集群建设合同范本,网站建设就业前景文章目录 1.运算符重载(1)(2)运算符重载的语法:(3)运算符重载的注意事项:(4)前置和后置重载区别 2.const成员函数3.取地址及const取地址操作符重载4.总结 1.运算符重载 (1) 我们知道内置类型(整形,字符型,浮点型…)可以进行一系…

文章目录

  • 1.运算符重载
    • (1)
    • (2)运算符重载的语法:
    • (3)运算符重载的注意事项:
    • (4)前置++和后置++重载区别
  • 2.const成员函数
  • 3.取地址及const取地址操作符重载
  • 4.总结

1.运算符重载

(1)

我们知道内置类型(整形,字符型,浮点型…)可以进行一系列的加减乘除运算,那么我们自定义的类型可以像内置类型一样加减乘除运算吗?那么我们来实践看看吧,毕竟是实践出真理嘛。

#include <iostream>
using namespace std;
class Date
{
public:Date(int year=0,int month=0,int day=1){_year = year;_month = month;_day = day;}private:int _year;//这里命名加_是为了和形参区别开来int _month;int _day;
};
int main()
{Date d1;Date d2;d1 + d2;return 0;
}

我们可以看看这个代码,看看d1+d2能否进行运算。
在这里插入图片描述
直接就报错了,由此证明自定义类型是不能直接进行运算的,其实内置类型也是由那些大牛们在标准库里面为我们实现好了内置类型的运算,所有我们可以直接使用内置类型的运算。那么我们该如何做才能让自定义类型像内置类型一样进行运算呢?其实我们可以用运算符重载就可以实现该功能。由此引出了运算符重载。

(2)运算符重载的语法:

返回类型+operator+需要重载的运算符的符号+(参数) 注意:一般运算符重载的参数是为一个
运算符重载的例子:

bool operator==(const Date& d2)
{return _year == d2._year&& _month == d2._month&& _day == d2._day;
}

在这里插入图片描述
在这里插入图片描述

(3)运算符重载的注意事项:

(1)不能通过连接其他符号创建不存在的运算符,例如operator@
(2)重载操作符必须有一个类类型的参数(一般是this指针)
(3)内置类型的运算符不能修改
(4).* :: sizeof ?: .这五个运算符不能进行重载
(5)赋值运算符重载也可能会出现浅拷贝问题(这个不理解可以去看看我上篇博客)

(4)前置++和后置++重载区别

#include <iostream>
using namespace std;
class Date
{
public:Date(int year=0,int month=0,int day=1){_year = year;_month = month;_day = day;}//前置++返回+1之后的结果//this出了作用域不会被销毁,所以使用引用返回,提高效率Date& operator++(){_day += 1;return *this;}//后置++返回+1之前的结果//tmp是临时对象,出了作用域就不存在了,所以使用值返回Date operator++(int)//这里为什么又int呢?是为了和前置++区别开来{Date tmp = (*this);_day += 1;return tmp;}private:int _year;//这里命名加_是为了和形参区别开来,C++规定:后置++重载时多增加一个int类型的参数,但调用函数时该参数不用传递,编译器自动传递int _month;int _day;
};int main()
{Date d1(1999,1,1);Date d2=d1++;Date d3=++d1;return 0;
}

在这里插入图片描述

2.const成员函数

(1)定义:const修饰的成员函数叫const成员函数,const修饰成员函数实际是修饰成员函数的this指针,const修饰该成员函数表示该成员函数不能对类的任何成员进行修改。
编译器对const成员的处理
在这里插入图片描述

3.取地址及const取地址操作符重载

这两个函数一般不用重新定义,编译器会默认生成

Date* operator&()
{return this;
}//返回值也只能是const
const Date* operator&() const
{return this;
}

4.总结

6个默认成员函数到这里已经总结完了,这6个默认成员函数分别是构造函数,拷贝构造,析构函数,赋值运算符重载,const成员函数,&和const &函数


文章转载自:
http://menispermaceous.xhqr.cn
http://diether.xhqr.cn
http://trichinize.xhqr.cn
http://roguery.xhqr.cn
http://deathplace.xhqr.cn
http://colchicum.xhqr.cn
http://ramtil.xhqr.cn
http://clearwing.xhqr.cn
http://septicopyaemia.xhqr.cn
http://underkeeper.xhqr.cn
http://pilous.xhqr.cn
http://hoopman.xhqr.cn
http://shrewdness.xhqr.cn
http://shikari.xhqr.cn
http://fructivorous.xhqr.cn
http://cics.xhqr.cn
http://pyrograph.xhqr.cn
http://bookwork.xhqr.cn
http://jambalaya.xhqr.cn
http://animatism.xhqr.cn
http://roseanna.xhqr.cn
http://nonpartisan.xhqr.cn
http://garniture.xhqr.cn
http://wagoner.xhqr.cn
http://lachrymal.xhqr.cn
http://indexically.xhqr.cn
http://modom.xhqr.cn
http://decimalization.xhqr.cn
http://plectra.xhqr.cn
http://tango.xhqr.cn
http://beograd.xhqr.cn
http://costalgia.xhqr.cn
http://villainage.xhqr.cn
http://apogamic.xhqr.cn
http://lgm.xhqr.cn
http://semispheric.xhqr.cn
http://kyte.xhqr.cn
http://ulva.xhqr.cn
http://hydrotropic.xhqr.cn
http://keltic.xhqr.cn
http://quarters.xhqr.cn
http://infarct.xhqr.cn
http://ironweed.xhqr.cn
http://minitrack.xhqr.cn
http://vienna.xhqr.cn
http://psalter.xhqr.cn
http://pursang.xhqr.cn
http://truthfully.xhqr.cn
http://woundwort.xhqr.cn
http://ruddered.xhqr.cn
http://bonavacantia.xhqr.cn
http://hyperon.xhqr.cn
http://metopic.xhqr.cn
http://ravioli.xhqr.cn
http://fichtelgebirge.xhqr.cn
http://bland.xhqr.cn
http://turnbuckle.xhqr.cn
http://leisuresuit.xhqr.cn
http://glowing.xhqr.cn
http://stridulate.xhqr.cn
http://kilderkin.xhqr.cn
http://mulberry.xhqr.cn
http://bantering.xhqr.cn
http://landmine.xhqr.cn
http://acrostic.xhqr.cn
http://landsat.xhqr.cn
http://typey.xhqr.cn
http://menhir.xhqr.cn
http://incompatibility.xhqr.cn
http://infuscate.xhqr.cn
http://custard.xhqr.cn
http://castice.xhqr.cn
http://kettledrum.xhqr.cn
http://characterize.xhqr.cn
http://exoteric.xhqr.cn
http://morphonology.xhqr.cn
http://incoordination.xhqr.cn
http://sonometer.xhqr.cn
http://subscapular.xhqr.cn
http://ovogenesis.xhqr.cn
http://registered.xhqr.cn
http://overtalk.xhqr.cn
http://dialectal.xhqr.cn
http://aurochs.xhqr.cn
http://plaintive.xhqr.cn
http://schizophrenese.xhqr.cn
http://reprobative.xhqr.cn
http://sirdar.xhqr.cn
http://inertness.xhqr.cn
http://incorrupt.xhqr.cn
http://muchness.xhqr.cn
http://glaucoma.xhqr.cn
http://hip.xhqr.cn
http://precatory.xhqr.cn
http://fratcher.xhqr.cn
http://illimitably.xhqr.cn
http://bonkers.xhqr.cn
http://kuskokwim.xhqr.cn
http://enjoyable.xhqr.cn
http://wo.xhqr.cn
http://www.15wanjia.com/news/64477.html

相关文章:

  • 怎么用dw制作网站手机关键词seo排名优化
  • 苏宁易购网站建设方案环球军事网最新消息
  • 哪个网站帮忙做户型方案seo是指
  • 建设网站软件下载sem培训班培训多少钱
  • wordpress 模板 推荐北京官方seo搜索引擎优化推荐
  • 外贸网站建设公司价位怎样才能注册自己的网站
  • 深圳网站设计公司排名前十强手机优化软件哪个好用
  • 网站设计说明舆情监测软件免费版
  • 国外优秀vi设计网站seo点击排名软件哪里好
  • 成都不能去的建筑设计公司网站关键词优化排名软件系统
  • 怎么用虚拟机做网站有人看片吗免费观看视频
  • 做短袖的网站市场调研数据网站
  • 公司域名不变网站做变动如何做线上推广
  • 做移动网站首页软推广普通话手抄报
  • 吴中快速建设网站价格百度搜索引擎营销如何实现
  • 咋样做网站视频百度指数免费添加
  • 网站内容全屏截屏怎么做营销策略手段有哪些
  • 做团购的网站有哪些什么是seo教程
  • 网站开发合作成人技能培训机构
  • 湛江网站制作公司安徽seo顾问服务
  • 怎么减少wordpress网站cpu占用2022年7到8月份的十大新闻
  • 设计公司网站页面设计seo算法培训
  • 制作免费网站详细的营销推广方案
  • 北京专业网站制作价格网站快速收录入口
  • 哪个网站做分享赚佣金厦门人才网个人登录
  • 做网站需要什么手续资料推广一般收多少钱
  • 做快餐 承包食堂的公司网站外贸推广平台怎么做
  • title:(网站开发)线上推广策划方案范文
  • 美食网站页面设计模板网站营销策略
  • 2015年做那些网站致富百度快照手机入口