SlideShare une entreprise Scribd logo
1  sur  14
© Tyler Technologies 20131
Agenda
• Encapsulation
• Inheritance
• Polymorphism
• Association
• Aggregation
• Composition
© Tyler Technologies 20132
What is Encapsulation?
• Encapsulation is the condition of being enclosed. (as in a
capsule)
• With programming perspective, Enclosing “attributes” and
“methods” within a class would be called Encapsulation.
© Tyler Technologies 20133
Encapsulation Example
• Attributes are set to private.
• Methods defined are usually set to public.
• Methods may also be set to private, these methods
would only be called from with in the class.
© Tyler Technologies 20134
Static Methods
• Static Methods are class level methods that are called without creating an
instance of a class.
• The Static keyword instructs the system to create only one instance of the method
regardless of how many instances of its class you create.
• Declaring a Static Method:
• Calling a Static Method:
• Static methods are generally intended for cases where the following criteria are
met:
– The method has no reason to access the attributes that are declared in the Class
Declaration block of the class.
– The method has no reason to call any instance (non-static) methods of the class.
© Tyler Technologies 20135
Encapsulation - Benefits
• Encapsulation hides the implementation details.
• Ensures that structural change remains local:
– Changing the class internal code doesn’t effect any code on the outside.
– Changing the implementation inside a method does not effect the class
which is calling it.
• Encapsulation allows adding some logic while accessing any
attribute.
– E.g. in Accessor methods
• Hiding implementation details reduces complexity implying
easier maintenance.
© Tyler Technologies 20136
Inheritance
In Object Oriented Programming Inheritance is a way to:
• Reuse code of Existing Objects.
• Establish a subtype from an existing type.
Use inheritance for buidling is-a relationships
– E.g. cat is-an animal (cats are kind of animals)
Don't use it to build has-a relationship
– E.g. cat has-a name (cat is not kind of name)
© Tyler Technologies 20137
How Inheritance works?
Vehicle
Automobile
Car
Motor
Cycle
Aircraft
F-16
© Tyler Technologies 20138
What is being “Reused”?
© Tyler Technologies 20139
Inheritance - Benefits
• Inheritance has a lot of benefits
– Extensibility
– Reusability
– Provides abstraction
– Eliminates redundant code
• Inheritance allows a generalization of multiple child classes
which inherit the similar characteristics from a common
parent class.
– Attributes (fields and properties)
– Operations (methods)
• Child class can extend the parent class
– Add new fields and methods
– Redefine methods (modify existing behavior)
© Tyler Technologies 201310
Method Access Controls
• public : Access is not restricted.
• protected : Access is limited to the containing class or
types derived from the containing class.
• private : Access is limited to the containing class.
© Tyler Technologies 201311
• Poly means “different” while morph means “forms”.
• In programming Polymorphism may be achieved through
two concepts:
– Overloading:
– Overriding:
Polymorphism
© Tyler Technologies 201312
Overloading Concept
• Overloading is simply defined as the ability of one method to
perform different tasks.
• Creating multiple methods with *same name which differ
from each other by the change of parameter types or
quantity
© Tyler Technologies 201313
Overriding Accelerate for Aircraft
Jet
Aircraft needs to alter the accelerate functionality
provided by vehicle so it would override that method.
Vehicle
Car will use accelerate from the base class
Car
© Tyler Technologies 201314
Types of Relationships
Inheritance:
• “Is A” sort of relationship
For example
– Car is a vehicle
– Square is a shape
– Motorcycle is a vehicle
– Cat is a mammal
– Mammal is an Animal

Contenu connexe

Tendances

Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4MOHIT TOMAR
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principlesdeonpmeyer
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming ConceptsAbhigyan Singh Yadav
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programmingNeelesh Shukla
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oopcolleges
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingIqra khalil
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming conceptPina Parmar
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming ConceptsBhushan Nagaraj
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsEPAM
 
Oop concepts classes_objects
Oop concepts classes_objectsOop concepts classes_objects
Oop concepts classes_objectsWilliam Olivier
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .NetGreg Sohl
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]Rome468
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ FundamentalsSubhasis Nayak
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented ProgrammingAida Ramlan II
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Sakthi Durai
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 

Tendances (20)

Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Oops
OopsOops
Oops
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real Projects
 
Oop concepts classes_objects
Oop concepts classes_objectsOop concepts classes_objects
Oop concepts classes_objects
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]
 
C plusplus
C plusplusC plusplus
C plusplus
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented Programming
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Basic concepts of oops
Basic concepts of oopsBasic concepts of oops
Basic concepts of oops
 

En vedette

Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in phpSHIVANI SONI
 
SSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In HindiSSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In Hindikusumafoundation
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented languagefarhan amjad
 
Introduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesIntroduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesGuido Wachsmuth
 
Cbse class 10 hindi course b model answers by candidates 2015
Cbse class 10 hindi course b model answers by candidates 2015Cbse class 10 hindi course b model answers by candidates 2015
Cbse class 10 hindi course b model answers by candidates 2015Saurabh Singh Negi
 
हिन्दी व्याकरण
हिन्दी व्याकरणहिन्दी व्याकरण
हिन्दी व्याकरणChintan Patel
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programmingNgeam Soly
 
OOPs concept and implementation
OOPs concept and implementationOOPs concept and implementation
OOPs concept and implementationSandeep Kumar P K
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic Manzoor ALam
 
Vakya parichay
Vakya parichayVakya parichay
Vakya parichaysonia -
 

En vedette (20)

Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
Unit i
Unit iUnit i
Unit i
 
SSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In HindiSSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In Hindi
 
Oops
OopsOops
Oops
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
Labsheet2
Labsheet2Labsheet2
Labsheet2
 
Oops Concepts
Oops ConceptsOops Concepts
Oops Concepts
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented language
 
Introduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesIntroduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented Languages
 
Cbse class 10 hindi course b model answers by candidates 2015
Cbse class 10 hindi course b model answers by candidates 2015Cbse class 10 hindi course b model answers by candidates 2015
Cbse class 10 hindi course b model answers by candidates 2015
 
Labsheet1stud
Labsheet1studLabsheet1stud
Labsheet1stud
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
हिन्दी व्याकरण
हिन्दी व्याकरणहिन्दी व्याकरण
हिन्दी व्याकरण
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
 
OOPs concept and implementation
OOPs concept and implementationOOPs concept and implementation
OOPs concept and implementation
 
कारक
कारककारक
कारक
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic
 
Advance oops concepts
Advance oops conceptsAdvance oops concepts
Advance oops concepts
 
Vakya parichay
Vakya parichayVakya parichay
Vakya parichay
 
कारक(karak)
कारक(karak)कारक(karak)
कारक(karak)
 

Similaire à Object Oriented Programming

Object Oriented Programming.pptx
 Object Oriented Programming.pptx Object Oriented Programming.pptx
Object Oriented Programming.pptxShuvrojitMajumder
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingVasilios Kuznos
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed Farag
 
Cso gaddis java_chapter11
Cso gaddis java_chapter11Cso gaddis java_chapter11
Cso gaddis java_chapter11mlrbrown
 
Questpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPSQuestpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPSgdrealspace
 
Polymorphism
PolymorphismPolymorphism
PolymorphismNuha Noor
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - EncapsulationMichael Heron
 
Practical Object-Oriented Design in Ruby Ch7
Practical Object-Oriented Design in Ruby Ch7Practical Object-Oriented Design in Ruby Ch7
Practical Object-Oriented Design in Ruby Ch7Jerry Chen
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NETSabith Byari
 
Pi j3.1 inheritance
Pi j3.1 inheritancePi j3.1 inheritance
Pi j3.1 inheritancemcollison
 
Object oriented programming 3 object oriented concepts
Object oriented programming 3 object oriented conceptsObject oriented programming 3 object oriented concepts
Object oriented programming 3 object oriented conceptsVaibhav Khanna
 
chapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programmingchapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programmingWondimuBantihun1
 
04_-_Inheritance_Polymorphism_and_Interfaces.pdf
04_-_Inheritance_Polymorphism_and_Interfaces.pdf04_-_Inheritance_Polymorphism_and_Interfaces.pdf
04_-_Inheritance_Polymorphism_and_Interfaces.pdfmarkbrianBautista
 
Chapter 03 enscapsulation
Chapter 03 enscapsulationChapter 03 enscapsulation
Chapter 03 enscapsulationNurhanna Aziz
 
Java htp6e 09
Java htp6e 09Java htp6e 09
Java htp6e 09Ayesha ch
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSkillwise Group
 

Similaire à Object Oriented Programming (20)

Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Object Oriented Programming.pptx
 Object Oriented Programming.pptx Object Oriented Programming.pptx
Object Oriented Programming.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Cso gaddis java_chapter11
Cso gaddis java_chapter11Cso gaddis java_chapter11
Cso gaddis java_chapter11
 
Questpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPSQuestpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPS
 
Java session2
Java session2Java session2
Java session2
 
27c
27c27c
27c
 
27csharp
27csharp27csharp
27csharp
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
 
Practical Object-Oriented Design in Ruby Ch7
Practical Object-Oriented Design in Ruby Ch7Practical Object-Oriented Design in Ruby Ch7
Practical Object-Oriented Design in Ruby Ch7
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Pi j3.1 inheritance
Pi j3.1 inheritancePi j3.1 inheritance
Pi j3.1 inheritance
 
Object oriented programming 3 object oriented concepts
Object oriented programming 3 object oriented conceptsObject oriented programming 3 object oriented concepts
Object oriented programming 3 object oriented concepts
 
chapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programmingchapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programming
 
04_-_Inheritance_Polymorphism_and_Interfaces.pdf
04_-_Inheritance_Polymorphism_and_Interfaces.pdf04_-_Inheritance_Polymorphism_and_Interfaces.pdf
04_-_Inheritance_Polymorphism_and_Interfaces.pdf
 
Chapter 03 enscapsulation
Chapter 03 enscapsulationChapter 03 enscapsulation
Chapter 03 enscapsulation
 
Java htp6e 09
Java htp6e 09Java htp6e 09
Java htp6e 09
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 

Plus de Haris Bin Zahid

Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programmingHaris Bin Zahid
 
General Programming Concept
General Programming ConceptGeneral Programming Concept
General Programming ConceptHaris Bin Zahid
 
Abstraction and Encapsulation
Abstraction and EncapsulationAbstraction and Encapsulation
Abstraction and EncapsulationHaris Bin Zahid
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and InterfaceHaris Bin Zahid
 
Foundations of Selection
Foundations of SelectionFoundations of Selection
Foundations of SelectionHaris Bin Zahid
 
Human Resource Planning and Job Analysis
Human Resource Planning and Job AnalysisHuman Resource Planning and Job Analysis
Human Resource Planning and Job AnalysisHaris Bin Zahid
 
Employee Rights and HR Communications
Employee Rights and HR CommunicationsEmployee Rights and HR Communications
Employee Rights and HR CommunicationsHaris Bin Zahid
 
Equal Opportunity Employment
Equal Opportunity EmploymentEqual Opportunity Employment
Equal Opportunity EmploymentHaris Bin Zahid
 
Strategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM EnvironmentStrategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM EnvironmentHaris Bin Zahid
 

Plus de Haris Bin Zahid (11)

Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
 
General Programming Concept
General Programming ConceptGeneral Programming Concept
General Programming Concept
 
Abstraction and Encapsulation
Abstraction and EncapsulationAbstraction and Encapsulation
Abstraction and Encapsulation
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Recruiting
RecruitingRecruiting
Recruiting
 
Foundations of Selection
Foundations of SelectionFoundations of Selection
Foundations of Selection
 
Human Resource Planning and Job Analysis
Human Resource Planning and Job AnalysisHuman Resource Planning and Job Analysis
Human Resource Planning and Job Analysis
 
Employee Rights and HR Communications
Employee Rights and HR CommunicationsEmployee Rights and HR Communications
Employee Rights and HR Communications
 
Equal Opportunity Employment
Equal Opportunity EmploymentEqual Opportunity Employment
Equal Opportunity Employment
 
Fundamentals of HRM
Fundamentals of HRMFundamentals of HRM
Fundamentals of HRM
 
Strategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM EnvironmentStrategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM Environment
 

Dernier

tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
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
 
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
 
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
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 

Dernier (20)

tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
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 🔝✔️✔️
 
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-...
 
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
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 

Object Oriented Programming

  • 1. © Tyler Technologies 20131 Agenda • Encapsulation • Inheritance • Polymorphism • Association • Aggregation • Composition
  • 2. © Tyler Technologies 20132 What is Encapsulation? • Encapsulation is the condition of being enclosed. (as in a capsule) • With programming perspective, Enclosing “attributes” and “methods” within a class would be called Encapsulation.
  • 3. © Tyler Technologies 20133 Encapsulation Example • Attributes are set to private. • Methods defined are usually set to public. • Methods may also be set to private, these methods would only be called from with in the class.
  • 4. © Tyler Technologies 20134 Static Methods • Static Methods are class level methods that are called without creating an instance of a class. • The Static keyword instructs the system to create only one instance of the method regardless of how many instances of its class you create. • Declaring a Static Method: • Calling a Static Method: • Static methods are generally intended for cases where the following criteria are met: – The method has no reason to access the attributes that are declared in the Class Declaration block of the class. – The method has no reason to call any instance (non-static) methods of the class.
  • 5. © Tyler Technologies 20135 Encapsulation - Benefits • Encapsulation hides the implementation details. • Ensures that structural change remains local: – Changing the class internal code doesn’t effect any code on the outside. – Changing the implementation inside a method does not effect the class which is calling it. • Encapsulation allows adding some logic while accessing any attribute. – E.g. in Accessor methods • Hiding implementation details reduces complexity implying easier maintenance.
  • 6. © Tyler Technologies 20136 Inheritance In Object Oriented Programming Inheritance is a way to: • Reuse code of Existing Objects. • Establish a subtype from an existing type. Use inheritance for buidling is-a relationships – E.g. cat is-an animal (cats are kind of animals) Don't use it to build has-a relationship – E.g. cat has-a name (cat is not kind of name)
  • 7. © Tyler Technologies 20137 How Inheritance works? Vehicle Automobile Car Motor Cycle Aircraft F-16
  • 8. © Tyler Technologies 20138 What is being “Reused”?
  • 9. © Tyler Technologies 20139 Inheritance - Benefits • Inheritance has a lot of benefits – Extensibility – Reusability – Provides abstraction – Eliminates redundant code • Inheritance allows a generalization of multiple child classes which inherit the similar characteristics from a common parent class. – Attributes (fields and properties) – Operations (methods) • Child class can extend the parent class – Add new fields and methods – Redefine methods (modify existing behavior)
  • 10. © Tyler Technologies 201310 Method Access Controls • public : Access is not restricted. • protected : Access is limited to the containing class or types derived from the containing class. • private : Access is limited to the containing class.
  • 11. © Tyler Technologies 201311 • Poly means “different” while morph means “forms”. • In programming Polymorphism may be achieved through two concepts: – Overloading: – Overriding: Polymorphism
  • 12. © Tyler Technologies 201312 Overloading Concept • Overloading is simply defined as the ability of one method to perform different tasks. • Creating multiple methods with *same name which differ from each other by the change of parameter types or quantity
  • 13. © Tyler Technologies 201313 Overriding Accelerate for Aircraft Jet Aircraft needs to alter the accelerate functionality provided by vehicle so it would override that method. Vehicle Car will use accelerate from the base class Car
  • 14. © Tyler Technologies 201314 Types of Relationships Inheritance: • “Is A” sort of relationship For example – Car is a vehicle – Square is a shape – Motorcycle is a vehicle – Cat is a mammal – Mammal is an Animal

Notes de l'éditeur

  1. Agenda The following topics shall be discussed in this presentation: Encapsulation Inheritance Polymorphism Association Aggregation Composition
  2. Basic Definition of the term Encapsulation: “Encapsulation refers to the condition of being enclosed, as in a capsule.“ Relating the Encapsulation concept with a capsule really helps in associating the word “encapsulation” with what it actually means, also it benefits in recalling the definition and the idea later on. In essence Capsule is a one word definition for Encapsulation.
  3. This is how you achieve Encapsulation by bundling appropriate attributes and methods, i.e. by creating a class. The class diagram shows attributes to be privately accessible while all the functions are public.
  4. In X++ you can decorate a method with the static keyword. This keyword instructs the system to create only one instance of the method regardless of how many instances of its class you create. Static methods are generally intended for cases where the following criteria are met: The method has no reason to access the member variables that are declared in the classDeclaration block of the class. The method has no reason to call any instance (non-static) methods of the class. Because static methods do not operate on objects, you do not need to create an instance of the class they belong to. Static methods cannot be called in the same way as nonstatic (instance) methods. Instead, you have to use the scope-operator ( :: ) ClassName::method() For example: Map::create(); If you wanted to create a method that uses a customer account to test whether a particular customer exists, this should be a static method. It would not make sense to create an object before calling this method—the object would already exist.
  5. Changes made to the code creates maintainability issues. Usually fields in a class are changed more often than the class’s constructors or methods. Encapsulation makes sure that when fields are changed, necessary changes can comparatively easily be done in the same class, and this change remain local to that class only, eliminating the chances of an external class being modified.
  6. Sole purpose of Inheritance is code reusability. Which establishes a subtype from an existing Type. Inheritance represents “is a” type of relationship, not to be confused with Association, Aggregation or Association as they are different concepts altogether.
  7. Representing in terms of a diagram, A vehicle is the most generalized Item under this example, so we can extract the common functionalities among all vehicles and put it under this class, Further more Vehicle is categorized under two subclasses one is automobile and the other is Aircraft. Automobile might have vehicles such as Car or Motor Cycle Where has Aircraft has F-16.
  8. As it is seen what Automobiles or aircraft have in common are put within Vehicle, for example there will always be a certain number of passengers traveling in a vehicle either it be Automobile or Aircraft. However there is no Altitude Value under Automobile. And there is no Gear value for an aircraft. So along with achieving specialization for the below classes we have reused the code by not defining common things in specialized classes and just putting them in a generalized class which is vehicle.
  9. By extending a class new functionality may be easily added up without entering redundant code. Base class’s code is being re used by the extended class without the need of entering it again. Inheritance allows a generalization of multiple child classes which inherit the similar characteristics from a common parent class. Attributes (fields and properties) Operations (methods) Child class can extend the parent class Add new fields and methods Redefine methods (modify existing behavior)
  10. The Public access modifier allows any class to access the method. All you have to do is create an instance of the method and for that instance the all public methods are accessible. If a method is defined as protected it can be accessed from within the class or from any derived class however any other class may not be able to access it. Private methods are only limited to be called from within the class. All attributes may always be private.
  11. Polymorphism has two concepts, Overloading and Overriding. Overloading is achieved within a class while overriding across different classes. It is important to note that Overloading is not supported in X++, Overloading is basically providing different implementations for a single method name, these implementations are distinguished by the signature of the method, the signature includes the parameters required to call the function, so we can achieve overloading by creating two functions with same name and different number of parameters or even with same number of parameters but with different types or order. For example consider we have an email method sendEmail(), This method sends email with default values, we can override this method and provide a separate implementation which takes a single string parameter as an input and give receiver's Email address in that parameter. We can provide another implementation that gets a list of string as a parameter and then later on in the implementation send the email to all the email addresses listed in that list of string.
  12. Overloading is basically providing different implementations for a single method name, these implementations are distinguished by the signature of the method, the signature includes the parameters required to call the function, so we can achieve overloading by creating two functions with same name and different number of parameters or even with same number of parameters but with different types or order. For example consider we have an email method sendEmail(), This method sends email with default values, we can override this method and provide a separate implementation which takes a single string parameter as an input and give receiver's Email address in that parameter. We can provide another implementation that gets a list of string as a parameter and then later on in the implementation send the email to all the email addresses listed in that list of string.
  13. Two classes Car and Jet have extended Vehicle. Jet has overridden the implementation provided for public method Accelerate method by Vehicle, hence the overridden implementation would be called for Jet class. Where as Car has provided no functionality for accelerate function so it will continue to use the same functionality as in Vehicle.