SlideShare a Scribd company logo
1 of 1
Download to read offline
Favor Composition does what and how?
Solution
We know what is inheritance, inheritance is an oops feature, acquiring existing properties form
the existing class isknow as inheritance. when a Field’s type is a class, the field will hold a
reference to another object, thus creating an association relationship between them. Without
getting into the nuances of the difference between simple association, aggregation, and
composition, let’s intuitively define composition as when the class uses another object to provide
some or all of its functionality.
Favor composition over inheritance is a one of the popular object-oriented design principles,
which helps to create flexible and maintainable code in Java and other object-oriented languages
A super class reference variable can refer to an instance of sub class. By using composition, you
don’t get this behavior, but still it offers a lot more to tilde the balance in its side.
Inheritance and composition relationships are also referred as IS-A and HAS-A relationships.
Favor composition give

More Related Content

Similar to Favor Composition does what and howSolutionWe know what is in.pdf

SAD02 - Object Orientation
SAD02 - Object OrientationSAD02 - Object Orientation
SAD02 - Object OrientationMichael Heron
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented RelationshipsTaher Barodawala
 
Inheritance and Substitution
Inheritance and SubstitutionInheritance and Substitution
Inheritance and Substitutionadil raja
 
Inheritance and its necessity in java.ppt
Inheritance and its necessity in java.pptInheritance and its necessity in java.ppt
Inheritance and its necessity in java.pptssuserf170c4
 
Lecture 13
Lecture 13Lecture 13
Lecture 13Rana Ali
 
Exploring the Pillars of Object java.pdf
Exploring the Pillars of Object java.pdfExploring the Pillars of Object java.pdf
Exploring the Pillars of Object java.pdfKajal Digital
 
java_vyshali.pdf
java_vyshali.pdfjava_vyshali.pdf
java_vyshali.pdfVyshali6
 
oopsinvb-191021101327.pdf
oopsinvb-191021101327.pdfoopsinvb-191021101327.pdf
oopsinvb-191021101327.pdfJP Chicano
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS abhishek kumar
 
Introduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.pptIntroduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.pptIKATrainingCentre
 

Similar to Favor Composition does what and howSolutionWe know what is in.pdf (20)

SAD02 - Object Orientation
SAD02 - Object OrientationSAD02 - Object Orientation
SAD02 - Object Orientation
 
General oops concepts
General oops conceptsGeneral oops concepts
General oops concepts
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Inheritance and Substitution
Inheritance and SubstitutionInheritance and Substitution
Inheritance and Substitution
 
Inheritance and its necessity in java.ppt
Inheritance and its necessity in java.pptInheritance and its necessity in java.ppt
Inheritance and its necessity in java.ppt
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
 
Exploring the Pillars of Object java.pdf
Exploring the Pillars of Object java.pdfExploring the Pillars of Object java.pdf
Exploring the Pillars of Object java.pdf
 
SAD04 - Inheritance
SAD04 - InheritanceSAD04 - Inheritance
SAD04 - Inheritance
 
java_vyshali.pdf
java_vyshali.pdfjava_vyshali.pdf
java_vyshali.pdf
 
oopsinvb-191021101327.pdf
oopsinvb-191021101327.pdfoopsinvb-191021101327.pdf
oopsinvb-191021101327.pdf
 
Oops in vb
Oops in vbOops in vb
Oops in vb
 
Objects and Instances.ppt
Objects and Instances.pptObjects and Instances.ppt
Objects and Instances.ppt
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Java pdf
Java   pdfJava   pdf
Java pdf
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
 
Code Reuseability
Code ReuseabilityCode Reuseability
Code Reuseability
 
Rbce
Rbce Rbce
Rbce
 
Introduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.pptIntroduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.ppt
 
Patterns of Value
Patterns of ValuePatterns of Value
Patterns of Value
 
Interesting Concept of Object Oriented Programming
Interesting Concept of Object Oriented Programming Interesting Concept of Object Oriented Programming
Interesting Concept of Object Oriented Programming
 

More from venkatesh24685

java programming 5th edition chapter 8 user defined classes and ADTs.pdf
java programming 5th edition chapter 8 user defined classes and ADTs.pdfjava programming 5th edition chapter 8 user defined classes and ADTs.pdf
java programming 5th edition chapter 8 user defined classes and ADTs.pdfvenkatesh24685
 
I need the code for a Java programming project. Allow the user to ty.pdf
I need the code for a Java programming project. Allow the user to ty.pdfI need the code for a Java programming project. Allow the user to ty.pdf
I need the code for a Java programming project. Allow the user to ty.pdfvenkatesh24685
 
How each of the main themes of The Fifth Discipline are related to e.pdf
How each of the main themes of The Fifth Discipline are related to e.pdfHow each of the main themes of The Fifth Discipline are related to e.pdf
How each of the main themes of The Fifth Discipline are related to e.pdfvenkatesh24685
 
Hi,BST question I was wondering why my insert function works p.pdf
Hi,BST question I was wondering why my insert function works p.pdfHi,BST question I was wondering why my insert function works p.pdf
Hi,BST question I was wondering why my insert function works p.pdfvenkatesh24685
 
Explain how character displacement can influence the speciation p.pdf
Explain how character displacement can influence the speciation p.pdfExplain how character displacement can influence the speciation p.pdf
Explain how character displacement can influence the speciation p.pdfvenkatesh24685
 
astronomy One Nineteenth Century observation which convinced many.pdf
astronomy One Nineteenth Century observation which convinced many.pdfastronomy One Nineteenth Century observation which convinced many.pdf
astronomy One Nineteenth Century observation which convinced many.pdfvenkatesh24685
 
A) For bipyridine (bipy) determine the maximum number of coordinatio.pdf
A) For bipyridine (bipy) determine the maximum number of coordinatio.pdfA) For bipyridine (bipy) determine the maximum number of coordinatio.pdf
A) For bipyridine (bipy) determine the maximum number of coordinatio.pdfvenkatesh24685
 
Describe two (2) attributes of a globally aware EngineerEngineering.pdf
Describe two (2) attributes of a globally aware EngineerEngineering.pdfDescribe two (2) attributes of a globally aware EngineerEngineering.pdf
Describe two (2) attributes of a globally aware EngineerEngineering.pdfvenkatesh24685
 
C# This program lets you pick from a choice of 8 items Circle, Squ.pdf
C# This program lets you pick from a choice of 8 items Circle, Squ.pdfC# This program lets you pick from a choice of 8 items Circle, Squ.pdf
C# This program lets you pick from a choice of 8 items Circle, Squ.pdfvenkatesh24685
 
“Our communication capabilities have raced ahead of our communicatio.pdf
“Our communication capabilities have raced ahead of our communicatio.pdf“Our communication capabilities have raced ahead of our communicatio.pdf
“Our communication capabilities have raced ahead of our communicatio.pdfvenkatesh24685
 
18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf
18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf
18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdfvenkatesh24685
 
You have identified a mutation in E. coli K-12 that causes it to bec.pdf
You have identified a mutation in E. coli K-12 that causes it to bec.pdfYou have identified a mutation in E. coli K-12 that causes it to bec.pdf
You have identified a mutation in E. coli K-12 that causes it to bec.pdfvenkatesh24685
 
Why are the EROI values for U.S. ethanol fuel from corn different in.pdf
Why are the EROI values for U.S. ethanol fuel from corn different in.pdfWhy are the EROI values for U.S. ethanol fuel from corn different in.pdf
Why are the EROI values for U.S. ethanol fuel from corn different in.pdfvenkatesh24685
 
Which of the following are parts of a bond Choose one or more A. t.pdf
Which of the following are parts of a bond Choose one or more A. t.pdfWhich of the following are parts of a bond Choose one or more A. t.pdf
Which of the following are parts of a bond Choose one or more A. t.pdfvenkatesh24685
 
When we decide to make something compensable we assert its value.pdf
When we decide to make something compensable we assert its value.pdfWhen we decide to make something compensable we assert its value.pdf
When we decide to make something compensable we assert its value.pdfvenkatesh24685
 
What is the role of ports for global commerce and why is that roe im.pdf
What is the role of ports for global commerce and why is that roe im.pdfWhat is the role of ports for global commerce and why is that roe im.pdf
What is the role of ports for global commerce and why is that roe im.pdfvenkatesh24685
 
What are the stages of team development Why is it important for a s.pdf
What are the stages of team development Why is it important for a s.pdfWhat are the stages of team development Why is it important for a s.pdf
What are the stages of team development Why is it important for a s.pdfvenkatesh24685
 
Two numbers together add to 300. One number is twice the size of the.pdf
Two numbers together add to 300. One number is twice the size of the.pdfTwo numbers together add to 300. One number is twice the size of the.pdf
Two numbers together add to 300. One number is twice the size of the.pdfvenkatesh24685
 
This Question 2 Pts The primary goal of financial accounting is to p.pdf
This Question 2 Pts The primary goal of financial accounting is to p.pdfThis Question 2 Pts The primary goal of financial accounting is to p.pdf
This Question 2 Pts The primary goal of financial accounting is to p.pdfvenkatesh24685
 
The irregularity of innovations and the variability of business prof.pdf
The irregularity of innovations and the variability of business prof.pdfThe irregularity of innovations and the variability of business prof.pdf
The irregularity of innovations and the variability of business prof.pdfvenkatesh24685
 

More from venkatesh24685 (20)

java programming 5th edition chapter 8 user defined classes and ADTs.pdf
java programming 5th edition chapter 8 user defined classes and ADTs.pdfjava programming 5th edition chapter 8 user defined classes and ADTs.pdf
java programming 5th edition chapter 8 user defined classes and ADTs.pdf
 
I need the code for a Java programming project. Allow the user to ty.pdf
I need the code for a Java programming project. Allow the user to ty.pdfI need the code for a Java programming project. Allow the user to ty.pdf
I need the code for a Java programming project. Allow the user to ty.pdf
 
How each of the main themes of The Fifth Discipline are related to e.pdf
How each of the main themes of The Fifth Discipline are related to e.pdfHow each of the main themes of The Fifth Discipline are related to e.pdf
How each of the main themes of The Fifth Discipline are related to e.pdf
 
Hi,BST question I was wondering why my insert function works p.pdf
Hi,BST question I was wondering why my insert function works p.pdfHi,BST question I was wondering why my insert function works p.pdf
Hi,BST question I was wondering why my insert function works p.pdf
 
Explain how character displacement can influence the speciation p.pdf
Explain how character displacement can influence the speciation p.pdfExplain how character displacement can influence the speciation p.pdf
Explain how character displacement can influence the speciation p.pdf
 
astronomy One Nineteenth Century observation which convinced many.pdf
astronomy One Nineteenth Century observation which convinced many.pdfastronomy One Nineteenth Century observation which convinced many.pdf
astronomy One Nineteenth Century observation which convinced many.pdf
 
A) For bipyridine (bipy) determine the maximum number of coordinatio.pdf
A) For bipyridine (bipy) determine the maximum number of coordinatio.pdfA) For bipyridine (bipy) determine the maximum number of coordinatio.pdf
A) For bipyridine (bipy) determine the maximum number of coordinatio.pdf
 
Describe two (2) attributes of a globally aware EngineerEngineering.pdf
Describe two (2) attributes of a globally aware EngineerEngineering.pdfDescribe two (2) attributes of a globally aware EngineerEngineering.pdf
Describe two (2) attributes of a globally aware EngineerEngineering.pdf
 
C# This program lets you pick from a choice of 8 items Circle, Squ.pdf
C# This program lets you pick from a choice of 8 items Circle, Squ.pdfC# This program lets you pick from a choice of 8 items Circle, Squ.pdf
C# This program lets you pick from a choice of 8 items Circle, Squ.pdf
 
“Our communication capabilities have raced ahead of our communicatio.pdf
“Our communication capabilities have raced ahead of our communicatio.pdf“Our communication capabilities have raced ahead of our communicatio.pdf
“Our communication capabilities have raced ahead of our communicatio.pdf
 
18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf
18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf
18. The density of a noble gas at STP is 1.784 gL. Identify the nobl.pdf
 
You have identified a mutation in E. coli K-12 that causes it to bec.pdf
You have identified a mutation in E. coli K-12 that causes it to bec.pdfYou have identified a mutation in E. coli K-12 that causes it to bec.pdf
You have identified a mutation in E. coli K-12 that causes it to bec.pdf
 
Why are the EROI values for U.S. ethanol fuel from corn different in.pdf
Why are the EROI values for U.S. ethanol fuel from corn different in.pdfWhy are the EROI values for U.S. ethanol fuel from corn different in.pdf
Why are the EROI values for U.S. ethanol fuel from corn different in.pdf
 
Which of the following are parts of a bond Choose one or more A. t.pdf
Which of the following are parts of a bond Choose one or more A. t.pdfWhich of the following are parts of a bond Choose one or more A. t.pdf
Which of the following are parts of a bond Choose one or more A. t.pdf
 
When we decide to make something compensable we assert its value.pdf
When we decide to make something compensable we assert its value.pdfWhen we decide to make something compensable we assert its value.pdf
When we decide to make something compensable we assert its value.pdf
 
What is the role of ports for global commerce and why is that roe im.pdf
What is the role of ports for global commerce and why is that roe im.pdfWhat is the role of ports for global commerce and why is that roe im.pdf
What is the role of ports for global commerce and why is that roe im.pdf
 
What are the stages of team development Why is it important for a s.pdf
What are the stages of team development Why is it important for a s.pdfWhat are the stages of team development Why is it important for a s.pdf
What are the stages of team development Why is it important for a s.pdf
 
Two numbers together add to 300. One number is twice the size of the.pdf
Two numbers together add to 300. One number is twice the size of the.pdfTwo numbers together add to 300. One number is twice the size of the.pdf
Two numbers together add to 300. One number is twice the size of the.pdf
 
This Question 2 Pts The primary goal of financial accounting is to p.pdf
This Question 2 Pts The primary goal of financial accounting is to p.pdfThis Question 2 Pts The primary goal of financial accounting is to p.pdf
This Question 2 Pts The primary goal of financial accounting is to p.pdf
 
The irregularity of innovations and the variability of business prof.pdf
The irregularity of innovations and the variability of business prof.pdfThe irregularity of innovations and the variability of business prof.pdf
The irregularity of innovations and the variability of business prof.pdf
 

Recently uploaded

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsPallavi Parmar
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfKartik Tiwari
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 

Recently uploaded (20)

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell Tolls
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 

Favor Composition does what and howSolutionWe know what is in.pdf

  • 1. Favor Composition does what and how? Solution We know what is inheritance, inheritance is an oops feature, acquiring existing properties form the existing class isknow as inheritance. when a Field’s type is a class, the field will hold a reference to another object, thus creating an association relationship between them. Without getting into the nuances of the difference between simple association, aggregation, and composition, let’s intuitively define composition as when the class uses another object to provide some or all of its functionality. Favor composition over inheritance is a one of the popular object-oriented design principles, which helps to create flexible and maintainable code in Java and other object-oriented languages A super class reference variable can refer to an instance of sub class. By using composition, you don’t get this behavior, but still it offers a lot more to tilde the balance in its side. Inheritance and composition relationships are also referred as IS-A and HAS-A relationships. Favor composition give