21
Inheritance & Interface of Java 창원대학교 정보통신공학과 Mobile-X 유지용 지도교수 : 박동규 2015.12.01.

Inheritance & Interface of Java

  • Upload
    ug-yong

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Inheritance & Interface of Java

Inheritance & Interface of Java

창원대학교 정보통신공학과 Mobile-X 유지용

지도교수 : 박동규 2015.12.01.

Page 2: Inheritance & Interface of Java

Inheritance

Page 3: Inheritance & Interface of Java

Inheritance

기존의 클래스를 재사용하여 새로운 클래스를 작성

코드의 양이 적어져 효율적

코드를 공통적으로 관리하여 유지보수가 용이

조상 클래스 - parent·super·base class 자손 클래스 - child·sub·derived class

Page 4: Inheritance & Interface of Java

Inheritance

Page 5: Inheritance & Interface of Java

Inheritance

super

sub sub

super

Page 6: Inheritance & Interface of Java

InheritanceObject

Human

Organism

Mammal

Page 7: Inheritance & Interface of Java

Inheritance

Page 8: Inheritance & Interface of Java

Inheritance

Elf클래스에서 선언하지 않았어도 Human클래스에서 선언

하였기에 사용가능

Page 9: Inheritance & Interface of Java

Inheritance

Page 10: Inheritance & Interface of Java

Inheritance

Page 11: Inheritance & Interface of Java

Inheritance

Page 12: Inheritance & Interface of Java

Inheritance

Page 13: Inheritance & Interface of Java

Inheritance

Page 14: Inheritance & Interface of Java

Inheritance

Page 15: Inheritance & Interface of Java

Inheritance

abstract void method (String name);

추상메서드를 구현 메소드의 리턴타입, 이름, 변수선언 세미콜론사용

Page 16: Inheritance & Interface of Java

Inheritance

Page 17: Inheritance & Interface of Java

Inheritance

Page 18: Inheritance & Interface of Java

Interface

추상메서드와 상수만으로 구성

모든 멤버변수는 public final static 이어야 하며, 이는 생략가능

모든 메서드는 public abstract 이어야 하며, 이는 생략가능

인터페이스는 다중상속이 가능

조상클래스가 다른 클래스들의 연결이 가능해진다

Page 19: Inheritance & Interface of Java

Interface

Page 20: Inheritance & Interface of Java

Interface

Page 21: Inheritance & Interface of Java

Reference Type of Java

제작지원