I want to create a member function with the same name of the returning type. Example:
class A { };
class B {
public:
A& A() { return *a; }
private:
A* a;
};
However, the compiler won't let me. I tried to change the type of the member return type to ::A
(as sugested here, but with no avail. I know I could just change the member name, but I just want to understand why does it has this restriction, and what are my workarounds.