Boolean and String Overloads of the Assignment Operator (C++)
问题 I am defining multiple overloads of the assignment operator as follows: Foo.h class Foo { private: bool my_bool; int my_int; std::string my_string; public: Foo& operator= (bool value); Foo& operator= (int value); Foo& operator= (const std::string& value); }; Foo.cpp // Assignment Operators. Foo& Foo::operator= (bool value) {my_bool = value; return *this;} Foo& Foo::operator= (int value) {my_int = value; return *this;} Foo& Foo::operator= (const std::string& value) {my_string = value; return