ariestamirra

Mypar

Apr 30th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. package LatihanPolymorphism;
  2.  
  3. class MyParent {
  4.  
  5.     int x, y;
  6.  
  7.     MyParent(int x, int y) {
  8.         this.x = x;
  9.         this.y = y;
  10.     }
  11.  
  12.     public int addMe(int x, int y) {
  13.         return this.x + x + y + this.y;
  14.     }
  15.  
  16.     public int addMe(MyParent myPar) {
  17.         return addMe(myPar.x, myPar.y);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment