Guest User

Untitled

a guest
Jan 21st, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. class A
  2. {
  3. protected:
  4. int x;
  5.  
  6. public:
  7. A(int x = 5) : x(x + 1)
  8. {
  9. cout << "In A::A x=" << x << endl;
  10. }
  11.  
  12. operator int() const { return x; }
  13. };
  14.  
  15. void main()
  16. {
  17. A a1(10);
  18. cout << a1 << endl ;
  19. }
  20.  
  21. In A:: An x=11
  22. 11
  23.  
  24. In A:: An x=10
  25. 11
Add Comment
Please, Sign In to add comment