Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class A{
  5. int x;
  6. int y;
  7. public:
  8. void print(){ cout << x << " " << y << endl; }
  9. void fun() const;
  10. void fun2();
  11. bool isEqual(A);
  12. };
  13. void A::fun() const{
  14. A obj;
  15. obj.x = 5;
  16. obj.y = 10;
  17. obj.print();
  18. }
  19. bool A::isEqual(A z){ if (z.x == z.y)return true; return false; }
  20. void A::fun2(){ A obj; obj.x = 7; obj.y = 8; }
  21.  
  22. int main(){
  23. A myObj;
  24. myObj.fun();
  25. A obj1, obj2;
  26. obj1.fun2();
  27. obj1.fun();
  28.  
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement