gpt4 book ai didi

C++ 运算符== 重载

转载 作者:可可西里 更新时间:2023-11-01 16:05:44 28 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Operator overloading

以下重载 operator== 的方式有什么区别?

// stroustrup way
friend bool operator== (MyClass &lhs, MyClass &rhs);

// as taught in other places, including caltech
bool MyClass::operator== (MyClass &rhs);

哪种方式更好?

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com