從零開始開發(fā)億級流量小紅書項目實戰(zhàn)
class Maker{public:
? ?Maker(string name, int age)
? ?{
? ? ? ?this->name = name;
? ? ? ?this->age = age;
? ?}
? ?// 模版函數(shù)局限性 解決方案2 重載運算符 (最優(yōu))
? ?// 重載>運算符
? ?bool operator>(Maker &b) {
? ? ? ?if (this->age > b.age)
? ? ? ?{
? ? ? ? ? ?return true;
? ? ? ?}else{
? ? ? ? ? ?return false;
? ? ? ?}
? ? ? ?
? ?}
標簽: