본문 바로가기
Class/220728

Class_Inheritance(1-3)

by pms93 2022. 7. 28.
package inheritance1;

public class Employee extends Person {
	
	private String dept;
	
	public String getDept() {
		return dept;
	}
	public void setDept(String dept) {
		this.dept = dept;
	}
	
	public void info() {
		System.out.println("이름 : " + super.getName());
		System.out.println("나이 : " + super.getAge());
		System.out.println("부서 : " + dept);
		System.out.println();
	}
	
}

'Class > 220728' 카테고리의 다른 글

Class_Inheritance(1-5)  (0) 2022.07.28
Class_Inheritance(1-4)  (0) 2022.07.28
Class_Inheritance(1-2)  (0) 2022.07.28
Class_Inheritance(1-1)  (0) 2022.07.28
Class_Overload(1-2)  (0) 2022.07.28