How to overload operator==() for a pointer to the class?

后端 未结 5 842
北海茫月
北海茫月 2020-12-06 18:06

I have a class called AString. It is pretty basic:

class AString
{
public:
    AString(const char *pSetString = NULL);
    ~AString();
    bool          


        
5条回答
  •  无人及你
    2020-12-06 18:41

    I think what you want is wrong since it obscures the type system of C++. myString is a pointer to a AString and not a AString. Dont't try to hide the fact that it's a pointer. It's an entry point for ugly bugs and if you're coding in a team everyone else would be nothing but confused!

提交回复
热议问题