摘要:
#include // overloading "operator = " outside class // 是二元操作符 ////////////////////////////////////////////////////////// class Rectangle { public: Rectangle(int w, int h) : width(w), height(... 阅读全文
摘要:
#include // overloading "operator = " inside class // = 是一元操作符。不写,编译器会提供 默认 拷贝赋值函数。可以通过显式“=delete”来禁用默认。对于复杂class的默认=可能会造成问题,请特别注意。 ////////////////////////////////////////////////////////// clas... 阅读全文
摘要:
#include <iostream> // overloading "operator == " outside class // == 是二元操作符 ////////////////////////////////////////////////////////// class Rectangle { public: Rectangle(int w, int h) : width(w), he 阅读全文
摘要:
#include // overloading "operator == " inside class // == 是二元操作符 ////////////////////////////////////////////////////////// class Rectangle { public: Rectangle(int w, int h) : width(w), heig... 阅读全文