카테고리 없음

부모자식 생성자

vlinders 2017. 11. 11. 14:37

(추상화)부모 클래스 생성자

1
2
3
4
5
6
7
8
9
10
11
12
13
 
public abstract class Parent {
    public int x,y;
    public Parent(int x, int y) {
        this.x = x;
        this.y = y;
    }
    
    public int getX() { return this.x; }
    public int getY() { return this.y; }
    
}
 
cs


자식 클래스 생성자

1
2
3
4
5
6
7
8
9
10
 
public class Child extends Parent {
 
    public Childe(int x, int y) {
        super(x, y);
        // TODO Auto-generated constructor stub
    }
    
}
 
cs