SlideShare uma empresa Scribd logo
1 de 14
04/08/16 NCACM University of Nevada, Las Vegas1
Object-Oriented Programming
Concepts
-Khursheed Mohammed
04/08/16 NCACM University2
Today’s PresentationToday’s Presentation
 What is an Object?
 What is a Class?
 What is a Message?
 Requirements of Object-Oriented language
 Step by step explanation
04/08/16 NCACM University3
What is an Object?
An object is a software bundle of related variables and methods.
Software objects are often used to model real-world objects you
find in everyday life.
Visual representation of a software object A bicycle modeled as a software object
04/08/16 NCACM University4
What is a Class?
A class is a blueprint or prototype that defines the variables and
the methods common to all objects of a certain kind.
 Class is an implementation of an abstract data type and
so encapsulates both data and operations.
 Object is run-time instance of class.
Classes just sit there, objects do the real work.
Memory is allocated for Objects not for Classes.
04/08/16 NCACM University5
What is a Message?
Software objects interact and communicate with each other
using messages.
 The object to which the message is addressed (YourBicycle)
 The name of the method to perform (changeGears)
 Any parameters needed by the method (lowerGear)
04/08/16 NCACM University6
To be object oriented, a language must support
 Encapsulation
 Inheritance
 Dynamic Binding
Some of the popular OO languages are
C++
Smalltalk
Java
Eiffel
FORTRAN90
CLOS(Common Lisp Object System)
Ada95
Modula-3
04/08/16 NCACM University7
Encapsulation:
Packaging an object's variables within the protective custody
of its methods is called encapsulation.
Often, for practical reasons, an object may wish to expose
some of its variables or hide some of its methods.
Access Levels:
Specifier Class Subclass Package World
Private X
Protected X X X
Public X X X X
04/08/16 NCACM University8
What is Inheritance?
A class inherits state and behavior from its superclass. Inheritance
provides a powerful and natural mechanism for organizing and
structuring software programs.
Super Class
Subclasses
04/08/16 NCACM University9
Properties:
Each subclass inherits state (in the form of variable declarations) from the superclass.
Subclasses can add variables and methods to the ones they inherit from the superclass.
Subclasses can also override inherited methods and provide specialized implementations
for those methods.
You are not limited to just one layer of inheritance. The inheritance tree, or class hierarchy,
can be as deep as needed.
Benefits:
Re-Usability
Subclasses provide specialized behaviors from the basis of common elements provided by the
superclass. Through the use of inheritance, programmers can reuse the code in the superclass
many times.
Can define Abstract Classes
Programmers can implement superclasses called abstract classes that define "generic"
behaviors.
04/08/16 NCACM University10
A
B
C
A B
C
A-1
A-2
B-1
B-2
AB
Multi-level Inheritance Multiple Inheritance
Multiple Multi-level Inheritance
Types of Inheritance:
04/08/16 NCACM University11
Dynamic Binding:
 Dynamic binding occurs when the type of variable changes at run-time.
A common way for a variable to change its type is via assignment.
Bike:= MoutainBike is safe
MountainBike:=Bike is not safe
MountainBike is declared to have all the features of Bike so the assignment
does no harm.
 A variable that starts life of the type Bike may be attached to any object
that is a kind of Bike, including MountainBike,RacingBike,…
 A variable that starts life of the type MountainBike can only be attached
to MountainBike objects but does not include RacingBike or general Bike.
04/08/16 NCACM University12
Polymorphism:
 The ability to appear in many forms.
 In object-oriented programming, polymorphism
refers to a programming language's ability to
process objects differently depending on their
data type or class.
It is the ability to redefine methods for derived
classes.
E.g. e-bike Acceleration system.
Electronically / Mechanically
04/08/16 NCACM University13
AcknowledgementsAcknowledgements
Dr. Yitung Chen
Dr. Hsuan-Tsung (Sean) Hsieh
04/08/16 NCACM University14
CONCLUSION

Mais conteúdo relacionado

Mais procurados

All 23 Design patterns in one page front and back
All 23 Design patterns in one page front and backAll 23 Design patterns in one page front and back
All 23 Design patterns in one page front and backTrey Brister
 
Implementing polymorphism
Implementing polymorphismImplementing polymorphism
Implementing polymorphismrajshreemuthiah
 
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
 
When & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsWhen & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsAlena Holligan
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersSatyam Jaiswal
 

Mais procurados (7)

All 23 Design patterns in one page front and back
All 23 Design patterns in one page front and backAll 23 Design patterns in one page front and back
All 23 Design patterns in one page front and back
 
Implementing polymorphism
Implementing polymorphismImplementing polymorphism
Implementing polymorphism
 
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
 
Pedersen naacl-2013-demo-poster-may25
Pedersen naacl-2013-demo-poster-may25Pedersen naacl-2013-demo-poster-may25
Pedersen naacl-2013-demo-poster-may25
 
When & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsWhen & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traits
 
Refactoring
RefactoringRefactoring
Refactoring
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 

Semelhante a OOP for java

Top 30 Technical interview questions
Top 30 Technical interview questionsTop 30 Technical interview questions
Top 30 Technical interview questionsSohailSaifi15
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
Review oop and ood
Review oop and oodReview oop and ood
Review oop and oodthan sare
 
Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Techglyphs
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsGaruda Trainings
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptxSajidTk2
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingmustafa sarac
 
Overview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtapOverview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtapVikas Jagtap
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxArifaMehreen1
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
Oop by edgar lagman jr
Oop by edgar lagman jr Oop by edgar lagman jr
Oop by edgar lagman jr Jun-jun Lagman
 
What is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxWhat is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxhreempandya
 
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docxA Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docxdaniahendric
 

Semelhante a OOP for java (20)

Oop
OopOop
Oop
 
Top 30 Technical interview questions
Top 30 Technical interview questionsTop 30 Technical interview questions
Top 30 Technical interview questions
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Review oop and ood
Review oop and oodReview oop and ood
Review oop and ood
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Bt8901 objective oriented systems1
Bt8901 objective oriented systems1
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptx
 
OOP design patterns
OOP design patternsOOP design patterns
OOP design patterns
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Overview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtapOverview of Object-Oriented Concepts Characteristics by vikas jagtap
Overview of Object-Oriented Concepts Characteristics by vikas jagtap
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Oop by edgar lagman jr
Oop by edgar lagman jr Oop by edgar lagman jr
Oop by edgar lagman jr
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
 
What is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptxWhat is OOP_ (Object Oriented Programming) (1).pptx
What is OOP_ (Object Oriented Programming) (1).pptx
 
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docxA Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
 
Ooad 2
Ooad 2Ooad 2
Ooad 2
 

Mais de mha4

Mule chapter2
Mule chapter2Mule chapter2
Mule chapter2mha4
 
Mule Introduction
Mule IntroductionMule Introduction
Mule Introductionmha4
 
Introduce Mule
Introduce MuleIntroduce Mule
Introduce Mulemha4
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object javamha4
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slotsmha4
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slotsmha4
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slotsmha4
 
05 junit
05 junit05 junit
05 junitmha4
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slotsmha4
 

Mais de mha4 (9)

Mule chapter2
Mule chapter2Mule chapter2
Mule chapter2
 
Mule Introduction
Mule IntroductionMule Introduction
Mule Introduction
 
Introduce Mule
Introduce MuleIntroduce Mule
Introduce Mule
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object java
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots
 
05 junit
05 junit05 junit
05 junit
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 

Último

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 

Último (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 

OOP for java

  • 1. 04/08/16 NCACM University of Nevada, Las Vegas1 Object-Oriented Programming Concepts -Khursheed Mohammed
  • 2. 04/08/16 NCACM University2 Today’s PresentationToday’s Presentation  What is an Object?  What is a Class?  What is a Message?  Requirements of Object-Oriented language  Step by step explanation
  • 3. 04/08/16 NCACM University3 What is an Object? An object is a software bundle of related variables and methods. Software objects are often used to model real-world objects you find in everyday life. Visual representation of a software object A bicycle modeled as a software object
  • 4. 04/08/16 NCACM University4 What is a Class? A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.  Class is an implementation of an abstract data type and so encapsulates both data and operations.  Object is run-time instance of class. Classes just sit there, objects do the real work. Memory is allocated for Objects not for Classes.
  • 5. 04/08/16 NCACM University5 What is a Message? Software objects interact and communicate with each other using messages.  The object to which the message is addressed (YourBicycle)  The name of the method to perform (changeGears)  Any parameters needed by the method (lowerGear)
  • 6. 04/08/16 NCACM University6 To be object oriented, a language must support  Encapsulation  Inheritance  Dynamic Binding Some of the popular OO languages are C++ Smalltalk Java Eiffel FORTRAN90 CLOS(Common Lisp Object System) Ada95 Modula-3
  • 7. 04/08/16 NCACM University7 Encapsulation: Packaging an object's variables within the protective custody of its methods is called encapsulation. Often, for practical reasons, an object may wish to expose some of its variables or hide some of its methods. Access Levels: Specifier Class Subclass Package World Private X Protected X X X Public X X X X
  • 8. 04/08/16 NCACM University8 What is Inheritance? A class inherits state and behavior from its superclass. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs. Super Class Subclasses
  • 9. 04/08/16 NCACM University9 Properties: Each subclass inherits state (in the form of variable declarations) from the superclass. Subclasses can add variables and methods to the ones they inherit from the superclass. Subclasses can also override inherited methods and provide specialized implementations for those methods. You are not limited to just one layer of inheritance. The inheritance tree, or class hierarchy, can be as deep as needed. Benefits: Re-Usability Subclasses provide specialized behaviors from the basis of common elements provided by the superclass. Through the use of inheritance, programmers can reuse the code in the superclass many times. Can define Abstract Classes Programmers can implement superclasses called abstract classes that define "generic" behaviors.
  • 10. 04/08/16 NCACM University10 A B C A B C A-1 A-2 B-1 B-2 AB Multi-level Inheritance Multiple Inheritance Multiple Multi-level Inheritance Types of Inheritance:
  • 11. 04/08/16 NCACM University11 Dynamic Binding:  Dynamic binding occurs when the type of variable changes at run-time. A common way for a variable to change its type is via assignment. Bike:= MoutainBike is safe MountainBike:=Bike is not safe MountainBike is declared to have all the features of Bike so the assignment does no harm.  A variable that starts life of the type Bike may be attached to any object that is a kind of Bike, including MountainBike,RacingBike,…  A variable that starts life of the type MountainBike can only be attached to MountainBike objects but does not include RacingBike or general Bike.
  • 12. 04/08/16 NCACM University12 Polymorphism:  The ability to appear in many forms.  In object-oriented programming, polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. It is the ability to redefine methods for derived classes. E.g. e-bike Acceleration system. Electronically / Mechanically
  • 13. 04/08/16 NCACM University13 AcknowledgementsAcknowledgements Dr. Yitung Chen Dr. Hsuan-Tsung (Sean) Hsieh