How does one overload operator->*()?

Question:
How does one overload operator->*()?

Answer:
Here is an example:

struct bar {   void doSomething();}struct foo {   bar *operator ->* () { return bar_; }}void Foo (){   void (bar::*barFn)() = &bar::doSomething;   foo f;   (f->*barFn)(); // calls bar::doSomething;}

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: