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

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
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
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
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
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Recently uploaded (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
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
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
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
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

[NHN NEXT] Java 강의- Week3