code_junkie

istream operator

Nov 11th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. int main()
  2. {
  3. HandPhone A,B;
  4. A>>B;//overloading operator>> to simulate sending sms to another handphone(object)
  5. return 0;
  6. }
  7.  
  8. void operator >> (HandPhone& a, HandPhone& b)
  9. {
  10. // Add code here.
  11. }
  12.  
  13. B.sendMessageTo(A,Message("PLOP"));
  14.  
  15. class A;
  16. class B;
  17.  
  18. A operator << (A& a, const B& b) // a << b; sends b to a.
  19. {
  20. a.sendMessage(b);
  21. return a;
  22. }
Add Comment
Please, Sign In to add comment