Advertisement
karlicoss

why you can't overload operator.

Jun 15th, 2011
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement