is it valid if I define member functions with same name¶meters but different return types inside a class like this:
class Test { public: int a;
No.
You cannot overload on return type.
Why? The standard says so.
And it actually makes sense - you can't determine what function to call in all situations.