C++??????????????????
???????????? ???????[ 2012/8/29 10:45:52 ] ????????
????????????д??????????????????????????Щ??????????==??<??>???????????????д?????????????д????? C++ ???????????????????
??????????????????“????” ??????????????????????????????????????б???????C++????????????????name mangling????????????????????????????“????”??????????е??á????????????????????
????????????????????
class CMyCls
{
public:
bool operator == (const CMyCls& rhs); // 1.
bool operator == (const CMyCls& rhs) const; // 2.
bool operator == (CMyCls& rhs); // 3.
bool operator == (CMyCls& rhs) const; // 4.
};
void f1 (CMyCls& lhs?? const CMyCls& rhs);
{
lhs == rhs;
}
void f2 (const CMyCls& lhs?? const CMyCls& rhs);
{
lhs == rhs;
}
void f3 (CMyCls& lhs?? CMyCls& rhs);
{
lhs == rhs;
}
void f4 (const CMyCls& lhs?? CMyCls& rhs)
{
lhs == rhs;
}
??????? f1 - f4 ???????????????ε???????????f1?????????CMyCls????1 ???????????????f2????? 2 ???????????????f3??f4?????????
?????????????????????????????????????????????У?????????????????磺
class CMyCls
{
public:
bool operator == (const CMyCls& rhs) const
{
// ...
}
};
bool operator == (const CMyCls& lhs?? const CMyCls& rhs)
{
// ...
}
void f(const CMyCls& lhs?? const CMyCls& rhs)
{
lhs == rhs;
}
???????????????????????????????? f ???????????????????????????????????????????????????“???”?????????????????????塣??????????????????????????
class CMyCls
{
public:
bool operator == (const CMyCls& rhs)
{
// ...
}
};
bool operator == (const CMyCls& lhs?? const CMyCls& rhs)
{
// ...
}
void f1(const CMyCls& lhs?? const CMyCls& rhs)
{
lhs == rhs;
}
void f2(CMyCls& lhs?? const CMyCls& rhs)
{
lhs == rhs;
}
???????? f1????????????operator ==????f2????? CMyCls????????operator ==??????????д???????????????????????????????const??汾??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11