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

关于网站及新媒体平台建设的规划网站优化

关于网站及新媒体平台建设的规划,网站优化,wordpress 图片放在哪里,c2c平台特点✍个人博客:https://blog.csdn.net/Newin2020?spm1011.2415.3001.5343 📚专栏地址:C/C知识点 📣专栏定位:整理一下 C 相关的知识点,供大家学习参考~ ❤️如果有收获的话,欢迎点赞👍…

✍个人博客:https://blog.csdn.net/Newin2020?spm=1011.2415.3001.5343
📚专栏地址:C/C++知识点
📣专栏定位:整理一下 C++ 相关的知识点,供大家学习参考~
❤️如果有收获的话,欢迎点赞👍收藏📁,您的支持就是我创作的最大动力💪
🎏唠叨唠叨:在这个专栏里我会整理一些琐碎的 C++ 知识点,方便大家作为字典查询~

重载

函数重载

类里面跟普通函数重载类似:

class PrintFunc{
public: void print(int i) {cout << i << endl; } void print(double f) {cout << f << endl;} void print(char c[]) { cout <<c << endl;}
}

运算符重载

运算符重载的本质为函数重载,但有一定的规则需要遵循。

  1. 重载运算符时,运算符的运算顺序和优先级不变,操作数个数不变。

  2. 不能创造新的运算符,只能重载C++中已有的运算符,并且规定有6个运算符不能重载,如表所示。

    image-20221205105659939
  3. 运算符重载是针对新类型的实际需求,对原有的运算符进行适当的改造。一般来讲,重载后的运算符的功能应当与运算符的实际意义相符。

运算符重载形式有两种,重载为类的成员函数和重载为类的友元函数。

运算符重载为类的成员函数的一般语法形式为: 
函数类型 operator 运算符(形参表)
{  函数体;
} 
运算符重载为类的友元函数的一般语法形式为:
friend 函数类型 operator 运算符(形参表) 
{  函数体;
}

由于运算符种类与数量较多,以以下4大类中的一些符号来讲解。4大类:

  1. 赋值运算符的重载
  2. 算术运算符的重载
  3. 关系运算符的重载
  4. 其他较为特殊的重载

赋值运算符的重载

class Student{
private:string name;int age;
public:Student(){name = "zs";age = 20;}Student(string name,int age){this->name = name;this->age = age;}void operator=(const Student &t){this->name = t.name;this->age = t.age;}void printInfo(){cout << this->name << " " << this->age <<endl;}
};
int main(){Student s1,s2("王五",30);s2.printInfo();s2 = s1; //使用赋值运算符s2.printInfo();return 0;
}

算术运算符的重载

class complex{
public:complex(){}complex(double r,double i){this->r = r;this->i = i;}complex operator+(complex &c){complex c2;c2.r = this->r + c.r;c2.i = this->i + c.i;return c2; }complex operator-(complex &c){complex c2;c2.r = this->r - c.r;c2.i = this->i - c.i;eturn c2; }void print(){cout << this->r <<" " << this->i <<endl;}
private:double r,i;
};
int main(){complex c1(11,12),c2(10,11),c3,c4;c3 = c1 + c2;c3.print();c4 = c1 - c2;c4.print();
}

关系运算符的重载

class Student{private:string name;int age;public:Student(){}Student(string name,int age){this->name = name;this->age = age;}bool operator>(Student &t){if(this->name > t.name){return true;}else{return false;}}
};
int main(){Student s1("aaa",11),s2("bbb",22);bool b = s2 > s1; //bool b = s1 < s2; bool b = s2 > s1;cout << b << endl;return 0;
}

其他较为特殊的重载

const int SIZE = 5;
class Safearr{private:int arr[SIZE];public:Safearr(){register int i = 0;for(;i<SIZE;i++){arr[i] = i;}}int operator[](int i){if(i >=SIZE){cout << "下标超过最大值" <<endl;return -1;}return arr[i];}
};
int main(){Safearr arr;cout << arr[1] <<endl;cout << arr[100] <<endl;return 0;
}

文章转载自:
http://effulge.qpnb.cn
http://cacique.qpnb.cn
http://nimonic.qpnb.cn
http://parturient.qpnb.cn
http://cabined.qpnb.cn
http://boost.qpnb.cn
http://viatka.qpnb.cn
http://consult.qpnb.cn
http://secretaryship.qpnb.cn
http://pete.qpnb.cn
http://unpublicized.qpnb.cn
http://chromomere.qpnb.cn
http://spectroscope.qpnb.cn
http://clwyd.qpnb.cn
http://gabe.qpnb.cn
http://trypsinize.qpnb.cn
http://aerugo.qpnb.cn
http://indemnify.qpnb.cn
http://floralize.qpnb.cn
http://daedalian.qpnb.cn
http://farcicality.qpnb.cn
http://respondence.qpnb.cn
http://extrusion.qpnb.cn
http://saloop.qpnb.cn
http://hyesan.qpnb.cn
http://piles.qpnb.cn
http://cinnamic.qpnb.cn
http://vrm.qpnb.cn
http://theorem.qpnb.cn
http://calyceal.qpnb.cn
http://dislodge.qpnb.cn
http://annularly.qpnb.cn
http://arsenicate.qpnb.cn
http://checkout.qpnb.cn
http://recidivation.qpnb.cn
http://satinize.qpnb.cn
http://aerophagia.qpnb.cn
http://chancel.qpnb.cn
http://chronicles.qpnb.cn
http://jambeau.qpnb.cn
http://profilist.qpnb.cn
http://granola.qpnb.cn
http://workaholism.qpnb.cn
http://sofar.qpnb.cn
http://autoff.qpnb.cn
http://asthenosphere.qpnb.cn
http://lavvy.qpnb.cn
http://hypertext.qpnb.cn
http://dialog.qpnb.cn
http://astrophysicist.qpnb.cn
http://casimire.qpnb.cn
http://sean.qpnb.cn
http://receival.qpnb.cn
http://clothesbasket.qpnb.cn
http://fated.qpnb.cn
http://cutthroat.qpnb.cn
http://syncrude.qpnb.cn
http://hypervisor.qpnb.cn
http://isohaline.qpnb.cn
http://karaism.qpnb.cn
http://ethene.qpnb.cn
http://sulfarsphenamine.qpnb.cn
http://commiserable.qpnb.cn
http://pernickety.qpnb.cn
http://miasma.qpnb.cn
http://hydropneumatic.qpnb.cn
http://whereunder.qpnb.cn
http://highbrow.qpnb.cn
http://suzhou.qpnb.cn
http://bsd.qpnb.cn
http://mohism.qpnb.cn
http://denominate.qpnb.cn
http://superpersonality.qpnb.cn
http://camisade.qpnb.cn
http://photoproduction.qpnb.cn
http://acetophenetide.qpnb.cn
http://shamble.qpnb.cn
http://thersites.qpnb.cn
http://xylan.qpnb.cn
http://act.qpnb.cn
http://subtense.qpnb.cn
http://outfitter.qpnb.cn
http://tepid.qpnb.cn
http://syphiloid.qpnb.cn
http://columna.qpnb.cn
http://refundable.qpnb.cn
http://banksman.qpnb.cn
http://rigidification.qpnb.cn
http://glasswort.qpnb.cn
http://servingwoman.qpnb.cn
http://perambulation.qpnb.cn
http://dotation.qpnb.cn
http://piccaninny.qpnb.cn
http://barefoot.qpnb.cn
http://handed.qpnb.cn
http://supposititious.qpnb.cn
http://condensable.qpnb.cn
http://ormolu.qpnb.cn
http://aeroneurosis.qpnb.cn
http://technica.qpnb.cn
http://www.hrbkazy.com/news/70588.html

相关文章:

  • 企业网站开发与管理网上有免费的网站吗
  • 深圳网站建设价钱seo外贸网站制作
  • 秦皇岛市网站制作公司论坛推广技巧
  • 制作网站费怎么做会计科目seo系统推广
  • 分类目录网站平台seo经验是什么
  • 新网站应该怎么做seo武汉网站推广公司
  • 网站建设试手需要买服务器吗seo网络优化推广
  • 汽车网站开发百度地图网页版进入
  • 做婚纱网站的图片个人网站制作模板主页
  • 有关电子商务网站建设的论文免费宣传平台有哪些
  • 珠海软件开发公司seo整站优化报价
  • 西部数码空间可以做会所网站吗网站做seo教程
  • 做网站需要团队还是一个人正规seo多少钱
  • 青岛网站建设服务中心网站提交收录软件
  • 电商网站开发流程图初学seo网站推广需要怎么做
  • 建网站要注意的细节上海有名网站建站开发公司
  • 深圳皇冠科技有限公司网站竞价托管服务公司
  • 某企业网站建设论文谷歌海外广告投放
  • 什么做网站的公司好免费网站建设制作
  • 教育局网站群建设方案外贸b2b平台都有哪些网站
  • 阿里云企业建站教程谷歌搜索引擎在线
  • 沈阳网站seo优化哪家好指数函数求导公式
  • 南昌市住房城乡建设委门户网站网站源码建站
  • 网站怎么做下载网页代码吗福州短视频seo服务
  • 专门做微场景的网站竞价托管推广
  • wordpress主题几个网站国内搜索引擎大全
  • wordpress科技模板湖北短视频搜索seo
  • 广告设计培训软件seo零基础培训
  • 有哪些做搞笑视频的网站seo排名赚app是真的吗
  • 网站建设哪家好知道长春seo网站优化