For some strange reason, I need to call the operator->() method directly. For example:
class A {
public:
void foo() { printf("Foo"); }
};
class ARef {
public:
A* operator->() { return a; }
protected:
A* a;
};
If I have an ARef object, I can call foo() by writing:
aref->foo();
However, I want to get the pointer to the protected member ‘a’. How can I do this?
Note that this syntax works for all other operators as well:
For a cleaner syntax, you can a implement a
Get()function or overload the*operator to allow for&*arefas suggested by James McNellis.