SHARE
TWEET

why you can't overload operator.

karlicoss Jun 15th, 2011 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Y
  2. {
  3. public:
  4.     void f();
  5.     // ...
  6. };
  7.  
  8. class X
  9. {       // assume that you can overload .
  10.     Y* p;
  11.     Y& operator.() { return *p; }
  12.     void f();
  13.     // ...
  14. };
  15.  
  16. void g(X& x)
  17. {
  18.     x.f();      // X::f or Y::f or error?
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top