Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Beginner
Jun 6, 1997

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;
}
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap