SlideShare a Scribd company logo
1 of 103
Download to read offline
PL
 in
 Java
 
 
Week03
 
I n h e r i t a n c e
조영호
 
snatcher@nhn.com
 
상속
Conceptual Perspective
 
Implementation Perspective
 
객체지향
 
Object-Orientation
 
개념
 관점
 
구현
 관점
 
Conceptual Perspective
 
Implementation Perspective
 
객체지향
 
Object-Orientation
 
개념
 관점
 
구현
 관점
 
Type
 
Class
 
Conceptual Perspective
 
Implementation Perspective
 
객체지향
 
Object-Orientation
 
개념
 관점
 
구현
 관점
 
Generalization
 
Inheritance
 
To p i c s
 
Inheritance
Generalization
Composition
Method Overriding
super
super()
사람
 
요츠바
 
5살
 
class Person {	
String name;	
int age;	
	
Person() {	
this(사람, 1);	
}	
Person(String name, int age) {	
this.name = name;	
this.age= age;	
}	
String introduce() {	
return 이름 :  + name + , 나이  + age + 세;	
}	
}	
Person
 
Person yotsuba = new Person(요츠바, 5);	
System.out.println(yotsuba.introduce());
Person yotsuba = new Person(요츠바, 5);	
name = 요츠바
age = 5
 
Person
new Person()
 
킬러
 
class Killer {	
String name;	
int age;	
String warning;	
String weapon;	
Killer(String name, int age, String warning, 	
String weapon) {	
this.name = name;	
this.age = age;	
this.warning = warning;	
this.weapon = weapon ;	
}	
	
String introduce() {	
return 이름 :  + name + , 나이  + age + 세;	
}	
String getWeapon() {	
return weapon;	
}	
}	
Killer
 
Killer killerYotsuba = new Killer(요츠바, 5, You can tell me in hell., 총);	
System.out.println(killerYotsuba.introduce());	
System.out.println(killerYotsuba.getWeapon());
Killer killerYotsuba = new Killer(요츠바, 5, 	
You can tell me in hell., 총);	
name = 요츠바
age = 5
warning = You..
weapon = 총
 
Killer
new Killer()
 
Person  Killer
 
Person
 
name
age
 
introduce()
 
Killer
 
name
age
warning
weapon
 
introduce()
getWeapon()
 
Code Duplication
 
Person
 
name
age
 
introduce()
 
Killer
 
name
age
warning
weapon
 
introduce()
getWeapon()
 
Inheritance
 
Person
 
name
age
 
introduce()
 
Killer
 
warning
weapon
 
getWeapon()
 
class Killer extends Person {	
String warning;	
String weapon;	
Killer(String name, int age, String warning, String weapon) {	
this.name = name;	
this.age = age;	
this.warning = warning;	
this.weapon = weapon;	
}	
String getWeapon() {	
return weapon;	
}
}	
Killer extends Person
 
Person yotsuba = new Person(요츠바, 5);	
name = 요츠바
age = 5
 
Person
Killer killerYotsuba = new Killer(요츠바, 5, 	
You can tell me in hell., 총);	
name = 요츠바
age = 5
warning = You..
weapon = 총
 
Killer
Member Variable Inheritance
 
Person yotsuba = new Person(요츠바, 5);	
	
System.out.println(yotsuba.introduce());	
	
	
	
Killer killerYotsuba = new Killer(요츠바, 5, 	
You can tell me in hell., 총);	


System.out.println(killerYotsuba.introduce());	
System.out.println(killerYotsuba.getWeapon());	
Method Inheritacne
 
음악가
 
Person
Code Reuse
 
Inheritance
 
Person
 
name
age
 
introduce()
 
Musican
 
instrument
play()
 
public class Musician extends Person {	
String instrument;	
Musician(String name, int age, String instrument) {	
this.name = name;	
this.age = age;	
this.instrument = instrument;	
}	
String play() {	
return instrument +  연주;	
}	
}	
Musician extends Person
 
Musician musicanYotsuba = new Musician(요츠바, 5, 피리);	
System.out.println(musicanYotsuba.introduce());	
System.out.println(musicanYotsuba.play());
Code Reuse

More Related Content

Viewers also liked

[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기
[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기
[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기Young-Ho Cho
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignYoung-Ho Cho
 
[JWAP-2] DI & Spring
[JWAP-2] DI & Spring[JWAP-2] DI & Spring
[JWAP-2] DI & SpringYoung-Ho Cho
 
객체지향적인 도메인 레이어 구축하기
객체지향적인 도메인 레이어 구축하기객체지향적인 도메인 레이어 구축하기
객체지향적인 도메인 레이어 구축하기Young-Ho Cho
 
[JWPA-1]의존성 주입(Dependency injection)
[JWPA-1]의존성 주입(Dependency injection)[JWPA-1]의존성 주입(Dependency injection)
[JWPA-1]의존성 주입(Dependency injection)Young-Ho Cho
 
[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기Young-Ho Cho
 
도메인구현 KSUG 20151128
도메인구현 KSUG 20151128도메인구현 KSUG 20151128
도메인구현 KSUG 20151128beom kyun choi
 
[NHN NEXT] 2014 NHN NEXT 창의체험
[NHN NEXT] 2014 NHN NEXT 창의체험[NHN NEXT] 2014 NHN NEXT 창의체험
[NHN NEXT] 2014 NHN NEXT 창의체험Young-Ho Cho
 
Domain Driven Design Ch7
Domain Driven Design Ch7Domain Driven Design Ch7
Domain Driven Design Ch7Ryan Park
 
Roles, Responsibilities, Collaborations
Roles, Responsibilities, CollaborationsRoles, Responsibilities, Collaborations
Roles, Responsibilities, CollaborationsYoung-Ho Cho
 
DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)beom kyun choi
 
Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...
Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...
Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...Павел Ефимов
 
Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...
Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...
Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...Dharma Initiative
 
MICT presentation on Thailand’s Important Mission for Spectrum Re-farming
MICT presentation on Thailand’s Important Mission for Spectrum Re-farming MICT presentation on Thailand’s Important Mission for Spectrum Re-farming
MICT presentation on Thailand’s Important Mission for Spectrum Re-farming TelecomJournal
 

Viewers also liked (19)

[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기
[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기
[NEXT 프연 Week2] UNIX 명령어 간단하게 살펴보기
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
[JWAP-2] DI & Spring
[JWAP-2] DI & Spring[JWAP-2] DI & Spring
[JWAP-2] DI & Spring
 
객체지향적인 도메인 레이어 구축하기
객체지향적인 도메인 레이어 구축하기객체지향적인 도메인 레이어 구축하기
객체지향적인 도메인 레이어 구축하기
 
[JWPA-1]의존성 주입(Dependency injection)
[JWPA-1]의존성 주입(Dependency injection)[JWPA-1]의존성 주입(Dependency injection)
[JWPA-1]의존성 주입(Dependency injection)
 
[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기
 
도메인구현 KSUG 20151128
도메인구현 KSUG 20151128도메인구현 KSUG 20151128
도메인구현 KSUG 20151128
 
[NHN NEXT] 2014 NHN NEXT 창의체험
[NHN NEXT] 2014 NHN NEXT 창의체험[NHN NEXT] 2014 NHN NEXT 창의체험
[NHN NEXT] 2014 NHN NEXT 창의체험
 
Domain Driven Design Ch7
Domain Driven Design Ch7Domain Driven Design Ch7
Domain Driven Design Ch7
 
DDD 산책
DDD 산책DDD 산책
DDD 산책
 
Roles, Responsibilities, Collaborations
Roles, Responsibilities, CollaborationsRoles, Responsibilities, Collaborations
Roles, Responsibilities, Collaborations
 
DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)
 
OHS Certificate
OHS CertificateOHS Certificate
OHS Certificate
 
Steviose
StevioseSteviose
Steviose
 
Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...
Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...
Презентация 1.13 - Солнечно-водородное электроснабжение жилого комплекса в Та...
 
Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...
Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...
Química dos Elementos de Transição Experimental - Experimento I - Heranitrito...
 
MICT presentation on Thailand’s Important Mission for Spectrum Re-farming
MICT presentation on Thailand’s Important Mission for Spectrum Re-farming MICT presentation on Thailand’s Important Mission for Spectrum Re-farming
MICT presentation on Thailand’s Important Mission for Spectrum Re-farming
 
dave
davedave
dave
 
SIO_110_syllabus
SIO_110_syllabusSIO_110_syllabus
SIO_110_syllabus
 

Recently uploaded

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

[NHN NEXT] Java 강의- Week3