다형성1 [Java] 상속(Inheritance), 메서드 오버라이딩, 다형성, 다운캐스팅, 업캐스팅 상속이란? 새로운 클래스를 정의할 때 이미 구현된 클래스를 상속 받아서 속성이나 기능이 확장되는 클래스를 구현하는 것. 상위클래스는 하위클래스보다 일반적인 개념과 기능을 가진다. 하위클래스는 상위클래스보다 구체적인 개념과 기능을 가진다. 자바는 Single Inheritance만 지원하기 때문에 extends 뒤에는 단 하나의 class 만 사용할 수 있다. class B extends A{ } public class Customer { protected int customerID; protected String customerName; protected String customerGrade; int bonusPoint; double bonusRatio; } public class VIPCustomer .. 2021. 12. 21. 이전 1 다음