SlideShare a Scribd company logo
3
Most read
7
Most read
15
Most read
Part 1
Introduction
Object | Class
Encapsulation
Abstraction
Messaging
Polymorphism Presented by Nuzhat Ibrahim Memon
• In today era of internet, website and web based
operations, rapid application development (RAD) and
reusability of source code is very important.
• Object oriented techniques as methodology or as
paradigm is playing significant role in analysis, design
and implementation of software system.
• Software developed using object-oriented are
proclaimed to be more reliable, easier to maintain,
reuse and enhance.
• Object-oriented programming concepts started
originating in the 1960s.
• Since mid 1980s, it has become the main programming
paradigm used in the creation of new software.
• Some of the popular programming languages that
support object-oriented programming are C++, Java,
C#, VB .net , ASP .net and PHP. s
NUZHAT IBRAHIM MEMON
2
Presented by Nuzhat Ibrahim Memon
3
Boil(water)
Boil(milk)
Add(sugar)
Add(tea-powder)
Stir()
Serve()
the focus is on writing
functions or procedures which operate
on data
liquid-type
powder-type
Boil (liquid-type)
Add(powder-type)
Stir()
Serve()
Function/Methods
Data/variables
Function/Procedure/Methods
The way of programming can be divided into two categories namely
the focus is on object which
contains both data and functionality together.
• The power of object-oriented programming language enables
the programmer to create modular, reusable and extendable
code.
• Object-oriented programming uses as its fundamental
building block. Similar objects are classified using a
concept of class that support object-oriented.
• in procedure oriented programming , for library
application software, we will think of all processes
of library application and focus on the modules
like student registration, book issue, book return,
fine calculation
• For library application in object oriented
programming, our focus is on the object involved
in the application. Here we think of object like
student, book and librarian. We also need to think
of association between such objects. For eg,
student returns book.
Presented by Nuzhat Ibrahim Memon
4
Library Application (POP)
Students registration()
Book issue()
Book return()
Fine calculation()
Library Application (OOP)
Students
book
Librarian
Students registration()
Book issue()
Book return()
Fine calculation()
Abstraction
Encapsulation
Polymorphism
Inheritance
Presented by Nuzhat Ibrahim Memon
5
A computer language is object-oriented if they support
four specific object properties
4 Pillars of OOPs (A PIE)
• In the real world, objects are the entities of which the world is comprised.
• Some objects can be concrete things like person, car or a coffee cup.
While other objects may be abstract that do not represent things which can
be touched or seen; for example, concept like date and time.
Presented by Nuzhat Ibrahim Memon
6
Real world entities
Instance of class
Attributes / Properties / Data Fields
• All objects have unique identity and are distinguishable from each
other. In object-oriented terminology, such characteristics are
known as properties or attributes.
• In object oriented programming, attributes that describe the object
are also referred to as data fields.
• To uniquely identify the object, the value of these attributes are
used. These values are called State.
• State is used to distinguish objects from each other.
Behaviour
• Additionally the behaviour associated with objects. The behaviour is
also known as method.
Members or Features
• The data attributes and behavioral methods associated with an
object are collectively referred to as its members or features.
Presented by Nuzhat Ibrahim Memon
7
Name: Bob
City: Pune
Gender: Male
Birthdate: 1st March
Profession: Doctor
Name: Lily
City: Delhi
Gender: Female
Birthdate: 2nd May
Profession:Teacher
Name: xyz
Color: Blue
Model: xyz 2020
Manfacture: Honda
Name: abc
Color: Pink
Model: abc 2021
Manufacture: BMW
Presented by Nuzhat Ibrahim Memon
8
• Class can be considered as a blueprint for various objects.
• A class is a template for multiple objects with similar
features.
• It describes a group of objects with similar attributes and
common behavior. Similar objects are classified using a
concept of class.
• Objects in the same class share a common semantic
purpose.
• Thus, the class is a general concept used to embody all the
common features of a particular set of objects.
‘Car’
Presented by Nuzhat Ibrahim Memon
9
• For example, we have a class named
‘Person’ describing common attributes
and behaviors of all persons.
• In ’Person’ class , individual persons
are considered as objects and are
identified by the state; that is the value
of their attributes
Objects
Class
Few More Examples:
Class: Human Object: Man, Woman
Class: Animal Object: Cat, Dog, Rabbit
Class: Fruit Object: Apple, Mango, Kiwi
• For any computer program, two core elements are data and
function.
• Structured/ procedural programming views these two core
element as two separate entities;
whereas object-oriented programming views them as single
entity.
• In procedural programming, data can be altered by any
component of the program. It is not protected from modification.
• In Object Oriented Programming, this problem can be solved
using encapsulation.
Presented by Nuzhat Ibrahim Memon
10
Data
Data
Data
Procedure
Programming
Object 2
Object 1
Object 3
Data
Data Data
Object Oriented
Programming
• Data and method that manipulate data are guarded against modification or
misuse by other components of the program.
• This mechanism of providing protection to data and methods of a program is
called encapsulation.
• This is possible by wrapping data and methods into a single unit known as
class and declaring them as private.
• Private members of the class are not available directly to outside world. If
necessary , the data is made available via public methods.
• Thus, encapsulation provides data hiding capabilities.
• Encapsulation keeps the data safe from unintended actions and inadvertent
access by outside objects.
Presented by Nuzhat Ibrahim Memon
11
Class
Data /
Variable
Function /
Methods/
Behavior
• Data abstraction is a process of representing the essential features of the objects
without including implementation detail.
• Abstraction is a concept that hides complexity; it says what it does, but not how it
is done.
• Data abstraction is a technique that relies on the separation of interface and
implementation.
• Data abstraction provides the skeleton or templates for our use.
• The system hides certain details of how data is stored, created and maintained.
• Examples of data abstraction
• Abstract Data Types(ADT) or Structures (struct) in C/C++
• classes in C++/Java
• In ADT, we simply define a data type and set of operation on it. We do not show the
implementation of operations.
Presented by Nuzhat Ibrahim Memon
12
• Encapsulate protects data by making them
inaccessible from outside.
• Abstraction enables to represent data in which the
implementation details are hidden (abstracted).
Presented by Nuzhat Ibrahim Memon
13
• Different classes may have same methods with same name.
• Date class->display() , display the date object in
specific format
• Time class->display(), to display time in specific format
• person class -> display() to display the details of
person
• In object-oriented termixnology, a call to a method is
referred to as a message.
• When method ‘display’ is invoked in the program, how to
know which method is to be executed?
• This is determined using the object that invokes the method.
• Due to encapsulation, all method calls are handled by
objects that recognize the method
• For eg. If ‘display’ is called by an object of ‘person’ class, it
executes the display method defined in ‘person’ class.
Presented by Nuzhat Ibrahim Memon
14
class date class time class person
void display(){
System.out.println
(“Display the date
object in specific
format”);
}
void display(){
System.out.println
(“Display the
time in specific
format”);
}
void display(){
System.out.println
(“Display the
details of
person”);
}
date d_obj = new date();
time t_obj = new time();
person p_obj = new person();
d_obj.display();
t_obj,display();
p_obj.display();
Presented by Nuzhat Ibrahim Memon
15
• Polymorphism means ‘many forms’.
• The polymorphism is achieved using two type of overloading: function overloading and operator
overloading.
• The capability of using same names to mean different things in different contexts is called overloading.
Operator
Overloading
Function
Overloading
Polymorphism
Presented by Nuzhat Ibrahim Memon
16
• Function or method overloading
• It is possible to define more than one function with the same name in
object-oriented programming.
• The methods differs in signatures( number and type of parameters)
• Object- oriented programming allows defining more than one method
having same name but different signatures in a single class. This
feature is known as function or method overloading.
• Operator overloading
• Object oriented programming also allows writing expression using
operators on objects.
• Date d1 – date d2 and n1- n2; operator ‘-’ is performing in a different
way.
• The same operation is given different meanings upon the data type of
operands used. This type of polymorphism is achieved through
operator overloading.
Operator ‘+’
2 + 2 = 4 ‘in’ + ‘dia’ = ‘India’
Operator ‘-’
n1 - n2 date d1 – date d2
Area (l,w)
Area
(pi,r,r)
Shape
Area
( *b*h)
Max (int, int){
return int;
}
Max (array, size){
return int;
}
Nuzhat Memon
website:
nuzhatmemon.com
Email:
nuzhat.memon@gmail.com

More Related Content

What's hot (20)

PPT
Swing and AWT in java
Adil Mehmoood
 
PPTX
this keyword in Java.pptx
ParvizMirzayev2
 
PPTX
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Nuzhat Memon
 
PPTX
Namespaces in C#
yogita kachve
 
PPTX
constructors in java ppt
kunal kishore
 
PPTX
Java string handling
GaneshKumarKanthiah
 
PPT
Awt controls ppt
soumyaharitha
 
PPTX
Session tracking in servlets
vishal choudhary
 
PDF
Java Course 8: I/O, Files and Streams
Anton Keks
 
PPSX
Java Multi-threading programming
DrRajeshreeKhande
 
PPTX
Css selectors
Parth Trivedi
 
PDF
JAVA PROGRAMMING - The Collections Framework
Jyothishmathi Institute of Technology and Science Karimnagar
 
PPS
Wrapper class
kamal kotecha
 
PPTX
CSharp Presentation
Vishwa Mohan
 
PPTX
Lab #2: Introduction to Javascript
Walid Ashraf
 
PDF
Java String
Java2Blog
 
PPTX
Control structures in java
VINOTH R
 
PPTX
HOW TO CREATE A MODULE IN ODOO
Celine George
 
PPTX
Java Data Types
Spotle.ai
 
PPTX
Packages in java
Elizabeth alexander
 
Swing and AWT in java
Adil Mehmoood
 
this keyword in Java.pptx
ParvizMirzayev2
 
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Nuzhat Memon
 
Namespaces in C#
yogita kachve
 
constructors in java ppt
kunal kishore
 
Java string handling
GaneshKumarKanthiah
 
Awt controls ppt
soumyaharitha
 
Session tracking in servlets
vishal choudhary
 
Java Course 8: I/O, Files and Streams
Anton Keks
 
Java Multi-threading programming
DrRajeshreeKhande
 
Css selectors
Parth Trivedi
 
JAVA PROGRAMMING - The Collections Framework
Jyothishmathi Institute of Technology and Science Karimnagar
 
Wrapper class
kamal kotecha
 
CSharp Presentation
Vishwa Mohan
 
Lab #2: Introduction to Javascript
Walid Ashraf
 
Java String
Java2Blog
 
Control structures in java
VINOTH R
 
HOW TO CREATE A MODULE IN ODOO
Celine George
 
Java Data Types
Spotle.ai
 
Packages in java
Elizabeth alexander
 

Similar to Std 12 computer chapter 6 object oriented concepts (part 1) (20)

PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
PPTX
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
PPT
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
sagarjsicg
 
PPTX
introduction of Object oriented programming
RiturajJain8
 
PPT
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
PPTX
Principles of OOPs.pptx
LakshyaChauhan21
 
PDF
lecture.in ooop object orented programmeg.pdf
nabeehmohammedtaher
 
PPTX
Basics of object oriented programming
Nitin Kumar Kashyap
 
PPTX
CPP-Unit 1.pptx
YashKoli22
 
PPTX
Principles and advantages of oop ppt
daxesh chauhan
 
PPTX
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
PDF
6_Object-oriented-using-java.pdf object oriented programming concepts
harinipradeep15
 
PDF
Introduction to object oriented programming
Abzetdin Adamov
 
PDF
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
PDF
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
PPTX
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
PPTX
Oop ppt
Shani Manjara
 
PPTX
gxhrehsrejhvytftfltyflytdtydtydky5dyrdtrdrdtrd
wrushabhsirsat
 
PPTX
Birasa 1
Niyitegekabilly
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
sagarjsicg
 
introduction of Object oriented programming
RiturajJain8
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
Principles of OOPs.pptx
LakshyaChauhan21
 
lecture.in ooop object orented programmeg.pdf
nabeehmohammedtaher
 
Basics of object oriented programming
Nitin Kumar Kashyap
 
CPP-Unit 1.pptx
YashKoli22
 
Principles and advantages of oop ppt
daxesh chauhan
 
6_Object-oriented-using-java.pdf object oriented programming concepts
harinipradeep15
 
Introduction to object oriented programming
Abzetdin Adamov
 
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
Oop ppt
Shani Manjara
 
gxhrehsrejhvytftfltyflytdtydtydky5dyrdtrdrdtrd
wrushabhsirsat
 
Birasa 1
Niyitegekabilly
 
Ad

More from Nuzhat Memon (20)

PPTX
Std 10 chapter 11 data type, expression and operators important MCQs
Nuzhat Memon
 
PPTX
Std 10 Chapter 10 Introduction to C Language Important MCQs
Nuzhat Memon
 
PPTX
Std 12 chapter 7 Java Basics Important MCQs
Nuzhat Memon
 
PPTX
Std 12 computer chapter 8 classes and objects in java important MCQs
Nuzhat Memon
 
PPTX
Std 12 Computer Chapter 6 object oriented concept important mcqs
Nuzhat Memon
 
PPTX
Std 12 computer java basics part 3 control structure
Nuzhat Memon
 
PPTX
Std 12 Computer Chapter 7 Java Basics (Part 2)
Nuzhat Memon
 
PPTX
Std 12 Computer Chapter 13 other useful free tools and services important MCQs
Nuzhat Memon
 
PPTX
Std 12 Computer Chapter 9 Working with Array and String in Java important MCQs
Nuzhat Memon
 
PPTX
Std 10 computer chapter 10 introduction to c language (part2)
Nuzhat Memon
 
PPTX
Std 10 computer chapter 10 introduction to c language (part1)
Nuzhat Memon
 
PPTX
Std 10 computer chapter 9 Problems and Problem Solving
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 5 Using Pictures in Synfig (Practical 3: Masking to R...
Nuzhat Memon
 
PPTX
Chapter 5 Using Pictures in Synfig (Practical 2: Masking to hide area in synfig)
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 5 Using Pictures in Synfig (Practical 1 Basics Opera...
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 4 Introduction to Layers (Part 3 Solving Textual Exe...
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 4 Introduction to Layers (Part 2 Practical :Rotation ...
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 4 Introduction to Layers
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 3 Creating Animation using Synfig (Part 3) [practica...
Nuzhat Memon
 
PPTX
Std 11 Computer Chapter 3 Creating Animation using Synfig (part 1)
Nuzhat Memon
 
Std 10 chapter 11 data type, expression and operators important MCQs
Nuzhat Memon
 
Std 10 Chapter 10 Introduction to C Language Important MCQs
Nuzhat Memon
 
Std 12 chapter 7 Java Basics Important MCQs
Nuzhat Memon
 
Std 12 computer chapter 8 classes and objects in java important MCQs
Nuzhat Memon
 
Std 12 Computer Chapter 6 object oriented concept important mcqs
Nuzhat Memon
 
Std 12 computer java basics part 3 control structure
Nuzhat Memon
 
Std 12 Computer Chapter 7 Java Basics (Part 2)
Nuzhat Memon
 
Std 12 Computer Chapter 13 other useful free tools and services important MCQs
Nuzhat Memon
 
Std 12 Computer Chapter 9 Working with Array and String in Java important MCQs
Nuzhat Memon
 
Std 10 computer chapter 10 introduction to c language (part2)
Nuzhat Memon
 
Std 10 computer chapter 10 introduction to c language (part1)
Nuzhat Memon
 
Std 10 computer chapter 9 Problems and Problem Solving
Nuzhat Memon
 
Std 11 Computer Chapter 5 Using Pictures in Synfig (Practical 3: Masking to R...
Nuzhat Memon
 
Chapter 5 Using Pictures in Synfig (Practical 2: Masking to hide area in synfig)
Nuzhat Memon
 
Std 11 Computer Chapter 5 Using Pictures in Synfig (Practical 1 Basics Opera...
Nuzhat Memon
 
Std 11 Computer Chapter 4 Introduction to Layers (Part 3 Solving Textual Exe...
Nuzhat Memon
 
Std 11 Computer Chapter 4 Introduction to Layers (Part 2 Practical :Rotation ...
Nuzhat Memon
 
Std 11 Computer Chapter 4 Introduction to Layers
Nuzhat Memon
 
Std 11 Computer Chapter 3 Creating Animation using Synfig (Part 3) [practica...
Nuzhat Memon
 
Std 11 Computer Chapter 3 Creating Animation using Synfig (part 1)
Nuzhat Memon
 
Ad

Recently uploaded (20)

PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PPTX
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Quarter 1_PPT_PE & HEALTH 8_WEEK 3-4.pptx
ronajadolpnhs
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
Horarios de distribución de agua en julio
pegazohn1978
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Quarter 1_PPT_PE & HEALTH 8_WEEK 3-4.pptx
ronajadolpnhs
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 

Std 12 computer chapter 6 object oriented concepts (part 1)

  • 1. Part 1 Introduction Object | Class Encapsulation Abstraction Messaging Polymorphism Presented by Nuzhat Ibrahim Memon
  • 2. • In today era of internet, website and web based operations, rapid application development (RAD) and reusability of source code is very important. • Object oriented techniques as methodology or as paradigm is playing significant role in analysis, design and implementation of software system. • Software developed using object-oriented are proclaimed to be more reliable, easier to maintain, reuse and enhance. • Object-oriented programming concepts started originating in the 1960s. • Since mid 1980s, it has become the main programming paradigm used in the creation of new software. • Some of the popular programming languages that support object-oriented programming are C++, Java, C#, VB .net , ASP .net and PHP. s NUZHAT IBRAHIM MEMON 2
  • 3. Presented by Nuzhat Ibrahim Memon 3 Boil(water) Boil(milk) Add(sugar) Add(tea-powder) Stir() Serve() the focus is on writing functions or procedures which operate on data liquid-type powder-type Boil (liquid-type) Add(powder-type) Stir() Serve() Function/Methods Data/variables Function/Procedure/Methods The way of programming can be divided into two categories namely the focus is on object which contains both data and functionality together. • The power of object-oriented programming language enables the programmer to create modular, reusable and extendable code. • Object-oriented programming uses as its fundamental building block. Similar objects are classified using a concept of class that support object-oriented.
  • 4. • in procedure oriented programming , for library application software, we will think of all processes of library application and focus on the modules like student registration, book issue, book return, fine calculation • For library application in object oriented programming, our focus is on the object involved in the application. Here we think of object like student, book and librarian. We also need to think of association between such objects. For eg, student returns book. Presented by Nuzhat Ibrahim Memon 4 Library Application (POP) Students registration() Book issue() Book return() Fine calculation() Library Application (OOP) Students book Librarian Students registration() Book issue() Book return() Fine calculation()
  • 5. Abstraction Encapsulation Polymorphism Inheritance Presented by Nuzhat Ibrahim Memon 5 A computer language is object-oriented if they support four specific object properties 4 Pillars of OOPs (A PIE)
  • 6. • In the real world, objects are the entities of which the world is comprised. • Some objects can be concrete things like person, car or a coffee cup. While other objects may be abstract that do not represent things which can be touched or seen; for example, concept like date and time. Presented by Nuzhat Ibrahim Memon 6 Real world entities Instance of class
  • 7. Attributes / Properties / Data Fields • All objects have unique identity and are distinguishable from each other. In object-oriented terminology, such characteristics are known as properties or attributes. • In object oriented programming, attributes that describe the object are also referred to as data fields. • To uniquely identify the object, the value of these attributes are used. These values are called State. • State is used to distinguish objects from each other. Behaviour • Additionally the behaviour associated with objects. The behaviour is also known as method. Members or Features • The data attributes and behavioral methods associated with an object are collectively referred to as its members or features. Presented by Nuzhat Ibrahim Memon 7 Name: Bob City: Pune Gender: Male Birthdate: 1st March Profession: Doctor Name: Lily City: Delhi Gender: Female Birthdate: 2nd May Profession:Teacher Name: xyz Color: Blue Model: xyz 2020 Manfacture: Honda Name: abc Color: Pink Model: abc 2021 Manufacture: BMW
  • 8. Presented by Nuzhat Ibrahim Memon 8 • Class can be considered as a blueprint for various objects. • A class is a template for multiple objects with similar features. • It describes a group of objects with similar attributes and common behavior. Similar objects are classified using a concept of class. • Objects in the same class share a common semantic purpose. • Thus, the class is a general concept used to embody all the common features of a particular set of objects. ‘Car’
  • 9. Presented by Nuzhat Ibrahim Memon 9 • For example, we have a class named ‘Person’ describing common attributes and behaviors of all persons. • In ’Person’ class , individual persons are considered as objects and are identified by the state; that is the value of their attributes Objects Class Few More Examples: Class: Human Object: Man, Woman Class: Animal Object: Cat, Dog, Rabbit Class: Fruit Object: Apple, Mango, Kiwi
  • 10. • For any computer program, two core elements are data and function. • Structured/ procedural programming views these two core element as two separate entities; whereas object-oriented programming views them as single entity. • In procedural programming, data can be altered by any component of the program. It is not protected from modification. • In Object Oriented Programming, this problem can be solved using encapsulation. Presented by Nuzhat Ibrahim Memon 10 Data Data Data Procedure Programming Object 2 Object 1 Object 3 Data Data Data Object Oriented Programming
  • 11. • Data and method that manipulate data are guarded against modification or misuse by other components of the program. • This mechanism of providing protection to data and methods of a program is called encapsulation. • This is possible by wrapping data and methods into a single unit known as class and declaring them as private. • Private members of the class are not available directly to outside world. If necessary , the data is made available via public methods. • Thus, encapsulation provides data hiding capabilities. • Encapsulation keeps the data safe from unintended actions and inadvertent access by outside objects. Presented by Nuzhat Ibrahim Memon 11 Class Data / Variable Function / Methods/ Behavior
  • 12. • Data abstraction is a process of representing the essential features of the objects without including implementation detail. • Abstraction is a concept that hides complexity; it says what it does, but not how it is done. • Data abstraction is a technique that relies on the separation of interface and implementation. • Data abstraction provides the skeleton or templates for our use. • The system hides certain details of how data is stored, created and maintained. • Examples of data abstraction • Abstract Data Types(ADT) or Structures (struct) in C/C++ • classes in C++/Java • In ADT, we simply define a data type and set of operation on it. We do not show the implementation of operations. Presented by Nuzhat Ibrahim Memon 12
  • 13. • Encapsulate protects data by making them inaccessible from outside. • Abstraction enables to represent data in which the implementation details are hidden (abstracted). Presented by Nuzhat Ibrahim Memon 13
  • 14. • Different classes may have same methods with same name. • Date class->display() , display the date object in specific format • Time class->display(), to display time in specific format • person class -> display() to display the details of person • In object-oriented termixnology, a call to a method is referred to as a message. • When method ‘display’ is invoked in the program, how to know which method is to be executed? • This is determined using the object that invokes the method. • Due to encapsulation, all method calls are handled by objects that recognize the method • For eg. If ‘display’ is called by an object of ‘person’ class, it executes the display method defined in ‘person’ class. Presented by Nuzhat Ibrahim Memon 14 class date class time class person void display(){ System.out.println (“Display the date object in specific format”); } void display(){ System.out.println (“Display the time in specific format”); } void display(){ System.out.println (“Display the details of person”); } date d_obj = new date(); time t_obj = new time(); person p_obj = new person(); d_obj.display(); t_obj,display(); p_obj.display();
  • 15. Presented by Nuzhat Ibrahim Memon 15 • Polymorphism means ‘many forms’. • The polymorphism is achieved using two type of overloading: function overloading and operator overloading. • The capability of using same names to mean different things in different contexts is called overloading. Operator Overloading Function Overloading Polymorphism
  • 16. Presented by Nuzhat Ibrahim Memon 16 • Function or method overloading • It is possible to define more than one function with the same name in object-oriented programming. • The methods differs in signatures( number and type of parameters) • Object- oriented programming allows defining more than one method having same name but different signatures in a single class. This feature is known as function or method overloading. • Operator overloading • Object oriented programming also allows writing expression using operators on objects. • Date d1 – date d2 and n1- n2; operator ‘-’ is performing in a different way. • The same operation is given different meanings upon the data type of operands used. This type of polymorphism is achieved through operator overloading. Operator ‘+’ 2 + 2 = 4 ‘in’ + ‘dia’ = ‘India’ Operator ‘-’ n1 - n2 date d1 – date d2 Area (l,w) Area (pi,r,r) Shape Area ( *b*h) Max (int, int){ return int; } Max (array, size){ return int; }