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

视频变成网站怎么做理财产品网站开发文档

视频变成网站怎么做,理财产品网站开发文档,网上服装定制平台,常州网站建设哪家好关于C操作符重载&#xff0c;可以用类内的成员运算符重载或友元函数。但是注意两个不能同时出现&#xff0c;不然编译出错。 #include<iostream> using namespace std; class Complex{public:Complex(int r0,int i0){real r;imag i;}//#if 0Complex operator(Complex …

关于C++操作符重载,可以用类内的成员运算符重载或友元函数。但是注意两个不能同时出现,不然编译出错。

#include<iostream>
using namespace std;
class Complex{public:Complex(int r=0,int i=0){real = r;imag = i;}//#if 0Complex operator+(Complex &c) {cout << " internal function is called" << endl;Complex c2;c2.real = this->real + c.real;c2.imag = this->imag + c.imag;return c2;}
//    #endif void print();friend Complex operator+(int a,Complex &c2); //声明友元运算符重载函数,+的左侧是整数,右侧是类的对象 friend Complex operator+(Complex c1,int a);//声明友元运算符重载函数,+的右侧是整数,左侧是类的对象
//     friend Complex operator+(Complex c1,Complex c2);//声明友元运算符重载函数,+的右侧是整数,左侧是类的对象 private:int real;int imag;
};
Complex operator+(int a,Complex &c2)  //定义友元运算符重载函数,+的左侧是整数,右侧是类的对象 
{Complex temp;cout << "friend function 1 is called" << endl;temp.real = a+c2.real;temp.imag = c2.imag;return temp;
}
Complex operator+(Complex c1,int a)//定义友元运算符重载函数,+的右侧是整数,左侧是类的对象 
{Complex temp;cout << "friend function 2 is called" << endl;temp.real = c1.real+a;temp.imag = c1.imag;return temp;
} 
#if 0
Complex operator+(Complex c1,Complex c2)
{Complex temp;cout << "friend function 3 is called" << endl;temp.real = c1.real+c2.real;temp.imag = c1.imag+c2.imag;return temp;
}
#endifvoid Complex::print()
{cout<<real<<"+"<<imag<<'i'<<endl;
}int main()
{Complex co1(30,40),co2(30,40),co3,co4;co1.print();co3=100+co1;  //co3=operator+(100,co1); co3.print();co3=co2+100;  //co3=operator+(co2,100);co3.print();co4=co2+co3;co4.print();return 0;
}
http://www.yayakq.cn/news/46539/

相关文章:

  • 美橙极速建站系统厦门关键词优化网站
  • 电子商务网站建站目的合肥知名网站制作
  • wordpress 全站搜索网站托管服务协议
  • 漯河网站建设茂睿科技饶阳网站建设
  • 教学方面网站建设代理公司注册济南
  • 建设工程安全员教育网站wordpress 两个主题
  • 手机网站和pc网站杭州网站建设费用多少钱
  • asp网站免费完整源码seo站内优化教程
  • 重庆网站设计案例易语言网站怎么做
  • 网站建设 补充协议网站程序开发后怎么上线
  • 漯河公司做网站程序员自己做网站赚钱
  • 学校网站建设开发方案网站制作的
  • 做网站制作赚钱吗金点子招聘信息莱芜信息港
  • 网站开通微信支付收费wordpress json 插件
  • 个人业余做网站怎么弄外贸网站推广平台排名前十名
  • 哪个网站可以做网页网站建设内容方法
  • seo站长平台wordpress微信支付开发
  • 包头做网站企业建设租房子的网站
  • 长沙制作网站软件网站设计开发
  • 个人合法网站怎么做在线制作书封网站
  • 网站开发实施经费预算古典网站织梦模板
  • 海外购物网站大全手机微网站建设
  • wordpress技术教程 pdf网站的后续优化方案
  • 公司要我做网站_没有公司的材料是不是不可以做网站建设考试多选题
  • 线上投票怎么做网站栏目设计优化方案
  • 肇庆网站制作策划08影院WordPress源码
  • 单位网站建设建议对策宁波网站建设优化服务公司
  • 什么行业最需要网站建设网站首页html代码在哪
  • 美橙互联网站建设案例网站编程零基础入门
  • 连云制作企业网站做淘宝的导购网站