奋斗的阿南strive的博客4.5.2 左移运算符重载 作用:可以输出自定义数据类型 问题引出: // 定义类 class Person { public: int m_A; int m_B; Person(int a, int b) { m_A = a; m_B = b; } }; // 测试 void test01() { int a = ...
legendary_bruce的博客4.5 运算符重载 所谓两个自定义数据相加,即两个结构体,或者两个对象相加。等操作。 #include<iostream> using namespace std; class Person { public: int m_A; int m_B; //1、通过成员函数重载加号...
黑马金牌编程的博客左移运算符重载 作用:可以输出自定义类型 代码示例: #include <iostream> using namespace std; //左移运算符重载 class Person { friend ostream & operator<<(ostream &cout, Person &...