SlideShare a Scribd company logo
Object-Oriented
programming
Concepts
Name Muhammd Umair Sajjad
Roll No 531
Department BS(CS)(Evening)
Submitted to Mam Uswa Farooq
Submission date 16-06-2020
Govt. P/G Islamia College Faisalabad
13.1 OBJECT ORIENTED PROGRAMMING
:- Object-Oriented programming (OOP) is a programming
technique or method in which we design a program by using objects
and classes.
OBJECTS
LIVING THINGS
HUMAN ANIMALS
NON LIVING
THINGS
EACH ITEM
INCLUDE
CAR,DESK,TABLE
etc.
:- An object is an entity that
consists of data and functions
:- c++ and java are the example of
object oriented language
FEATURES
•Objects:-
Object oriented programming is based on object. An object is
an entity that is shown in fig.
• Classes:-
Classes are designs for creating objects. In classes we see what
is private and what is public.
• Real-world Modeling:-
It is based in real-world modeling. Entities have different
properties and capabilities in real world.
FEATURES
• Reuseability:-
We make function one time and use many time.
• Information Hiding:-
We show only those data that we want to show
the user.
• Polymorphism:-
Ability of object behave in multiple way.
13.2 OBJECTS
• Properties:-
Characteristics of an
object Example:-
Properties of a car is
• Color
• Price
• Model
• Engine Power
• Functions:-
It is the action
performed by an object
Example:-
Functions of a car is
• Start
• Stop
• Accelerate
• Reverse
13.3 ClASSES
:- A group of object with same properties.
:- Use as a model to create same type object.
:- Use to define the characteristics and function of object.
Declaring:-
Keyword class is used to declare classs which specifies variables
and functions that are common to all objects of class.
Access Specifiers:-
A command use to specify access level of the class member
•
Access Specifiers:-
Private
• It can only access within the class
Public
• It can access anywhere in the program
13.4 CREATING OBJECTS
:- A class is prototype for creatin object
:- Process of creating an object of class called instantiation
Executing Member Function:-
• The member function can be
executed after creating an
object.
Defining Member Function
outside Class:-
• The declaration of member
function specified within class.
• If define function outside we
use resolution operator (::).
13.5 CONSTRUCTORS
:- The member function has same name as class called
constructor.
Constructor cannot return any value
:- Use to initialize data member in the class.
Passing Parameters to Constructor:-
The parameters are written in parenthesis along with the
object name in declaration statement.
Constructor Overloading:-
When we declare multiple constructors with same name but
different parameters we called this constructor overloading.
13.6 DEFAULT COPY CONSTRUCTOR
:- A constructor which is available by default in all classes.
:- We give parameters in parenthesis or using assignment
operator.
13.7 DECONSTRUCTOR
:- A type of member function that is automatically executed
when an object of that class is destroyed is known as destructor.
:- Return no value
:- Cannot accept any parameter
:- Nmae is precede by sign (~)
13.8 OBJECT AS FUNCTION PARAMETERS
:- We can be passed object as parameter to member function
Returning Objects from Member Function:-
The method of returning an object from member function
is same as returning a simple variable
13.9 STATIC DATA MEMBER
:- A data member type that is shared among all objects of class
:- Define with static keyword
:- Characteristics of a static data member are same as normal
static variable
13.10 FRIENDS FUNCTION
:- A function that allow to access the private and protected
members of a
particular class from outside the class.
:- Normally private and protected member of any cannot be
accessed from
outside the class.
:- It enable the function to access the private and protected
members of Both
Ad

More Related Content

What's hot (20)

concept of oops
concept of oopsconcept of oops
concept of oops
prince sharma
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Madishetty Prathibha
 
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
MOHIT TOMAR
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
gourav kottawar
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)
indiangarg
 
Basics of Object Oriented Programming
Basics of Object Oriented ProgrammingBasics of Object Oriented Programming
Basics of Object Oriented Programming
Abhilash Nair
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft Developer
Lee Greffin
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 6 OOPS Concept
Chapter 6 OOPS ConceptChapter 6 OOPS Concept
Chapter 6 OOPS Concept
Amrit Kaur
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Md. Tanvir Hossain
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Army Public School and College -Faisal
 
C plusplus
C plusplusC plusplus
C plusplus
Niti Bansal
 
Object Oriented Programming Principles
Object Oriented Programming PrinciplesObject Oriented Programming Principles
Object Oriented Programming Principles
Andrew Ferlitsch
 
2 Object Oriented Programming
2 Object Oriented Programming2 Object Oriented Programming
2 Object Oriented Programming
Praveen M Jigajinni
 
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
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented Programming
Aida Ramlan II
 
Oops
OopsOops
Oops
Sankar Balasubramanian
 
Oops
OopsOops
Oops
Maheswarikrishnasamy
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
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
MOHIT TOMAR
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
gourav kottawar
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)
indiangarg
 
Basics of Object Oriented Programming
Basics of Object Oriented ProgrammingBasics of Object Oriented Programming
Basics of Object Oriented Programming
Abhilash Nair
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft Developer
Lee Greffin
 
Chapter 6 OOPS Concept
Chapter 6 OOPS ConceptChapter 6 OOPS Concept
Chapter 6 OOPS Concept
Amrit Kaur
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Md. Tanvir Hossain
 
Object Oriented Programming Principles
Object Oriented Programming PrinciplesObject Oriented Programming Principles
Object Oriented Programming Principles
Andrew Ferlitsch
 
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
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented Programming
Aida Ramlan II
 

Similar to Object oriented programming (20)

Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
anitashinde33
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
jayeshsoni49
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
Sudip Simkhada
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
PreethaV16
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
akreyi
 
Classes, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptxClasses, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptx
DivyaKS18
 
Object Oriented Programming notes provided
Object Oriented Programming notes providedObject Oriented Programming notes provided
Object Oriented Programming notes provided
dummydoona
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
Sunipa Bera
 
c++.pptxwjwjsijsnsksomammaoansnksooskskk
c++.pptxwjwjsijsnsksomammaoansnksooskskkc++.pptxwjwjsijsnsksomammaoansnksooskskk
c++.pptxwjwjsijsnsksomammaoansnksooskskk
mitivete
 
Constructor & Destructor
Constructor & DestructorConstructor & Destructor
Constructor & Destructor
KV(AFS) Utarlai, Barmer (Rajasthan)
 
OOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHatOOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHat
Scholarhat
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
Shailendra Veeru
 
OOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and ObjectOOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and Object
dkpawar
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
TigistTilahun1
 
asic computer is an electronic device that can receive, store, process, and o...
asic computer is an electronic device that can receive, store, process, and o...asic computer is an electronic device that can receive, store, process, and o...
asic computer is an electronic device that can receive, store, process, and o...
vaishalisharma125399
 
C++ppt. Classs and object, class and object
C++ppt. Classs and object, class and objectC++ppt. Classs and object, class and object
C++ppt. Classs and object, class and object
secondakay
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructor
Saharsh Anand
 
Oop ppt
Oop pptOop ppt
Oop ppt
Shani Manjara
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
Aadil Ansari
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptx
AbhilashTom4
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
anitashinde33
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
PreethaV16
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
akreyi
 
Classes, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptxClasses, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptx
DivyaKS18
 
Object Oriented Programming notes provided
Object Oriented Programming notes providedObject Oriented Programming notes provided
Object Oriented Programming notes provided
dummydoona
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
Sunipa Bera
 
c++.pptxwjwjsijsnsksomammaoansnksooskskk
c++.pptxwjwjsijsnsksomammaoansnksooskskkc++.pptxwjwjsijsnsksomammaoansnksooskskk
c++.pptxwjwjsijsnsksomammaoansnksooskskk
mitivete
 
OOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHatOOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHat
Scholarhat
 
OOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and ObjectOOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and Object
dkpawar
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
TigistTilahun1
 
asic computer is an electronic device that can receive, store, process, and o...
asic computer is an electronic device that can receive, store, process, and o...asic computer is an electronic device that can receive, store, process, and o...
asic computer is an electronic device that can receive, store, process, and o...
vaishalisharma125399
 
C++ppt. Classs and object, class and object
C++ppt. Classs and object, class and objectC++ppt. Classs and object, class and object
C++ppt. Classs and object, class and object
secondakay
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructor
Saharsh Anand
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
Aadil Ansari
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptx
AbhilashTom4
 
Ad

Recently uploaded (20)

How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Ad

Object oriented programming

  • 2. Name Muhammd Umair Sajjad Roll No 531 Department BS(CS)(Evening) Submitted to Mam Uswa Farooq Submission date 16-06-2020 Govt. P/G Islamia College Faisalabad
  • 3. 13.1 OBJECT ORIENTED PROGRAMMING :- Object-Oriented programming (OOP) is a programming technique or method in which we design a program by using objects and classes. OBJECTS LIVING THINGS HUMAN ANIMALS NON LIVING THINGS EACH ITEM INCLUDE CAR,DESK,TABLE etc.
  • 4. :- An object is an entity that consists of data and functions :- c++ and java are the example of object oriented language
  • 5. FEATURES •Objects:- Object oriented programming is based on object. An object is an entity that is shown in fig. • Classes:- Classes are designs for creating objects. In classes we see what is private and what is public. • Real-world Modeling:- It is based in real-world modeling. Entities have different properties and capabilities in real world.
  • 6. FEATURES • Reuseability:- We make function one time and use many time. • Information Hiding:- We show only those data that we want to show the user. • Polymorphism:- Ability of object behave in multiple way.
  • 7. 13.2 OBJECTS • Properties:- Characteristics of an object Example:- Properties of a car is • Color • Price • Model • Engine Power • Functions:- It is the action performed by an object Example:- Functions of a car is • Start • Stop • Accelerate • Reverse
  • 8. 13.3 ClASSES :- A group of object with same properties. :- Use as a model to create same type object. :- Use to define the characteristics and function of object. Declaring:- Keyword class is used to declare classs which specifies variables and functions that are common to all objects of class. Access Specifiers:- A command use to specify access level of the class member •
  • 9. Access Specifiers:- Private • It can only access within the class Public • It can access anywhere in the program
  • 10. 13.4 CREATING OBJECTS :- A class is prototype for creatin object :- Process of creating an object of class called instantiation Executing Member Function:- • The member function can be executed after creating an object. Defining Member Function outside Class:- • The declaration of member function specified within class. • If define function outside we use resolution operator (::).
  • 11. 13.5 CONSTRUCTORS :- The member function has same name as class called constructor. Constructor cannot return any value :- Use to initialize data member in the class. Passing Parameters to Constructor:- The parameters are written in parenthesis along with the object name in declaration statement. Constructor Overloading:- When we declare multiple constructors with same name but different parameters we called this constructor overloading.
  • 12. 13.6 DEFAULT COPY CONSTRUCTOR :- A constructor which is available by default in all classes. :- We give parameters in parenthesis or using assignment operator.
  • 13. 13.7 DECONSTRUCTOR :- A type of member function that is automatically executed when an object of that class is destroyed is known as destructor. :- Return no value :- Cannot accept any parameter :- Nmae is precede by sign (~)
  • 14. 13.8 OBJECT AS FUNCTION PARAMETERS :- We can be passed object as parameter to member function Returning Objects from Member Function:- The method of returning an object from member function is same as returning a simple variable
  • 15. 13.9 STATIC DATA MEMBER :- A data member type that is shared among all objects of class :- Define with static keyword :- Characteristics of a static data member are same as normal static variable
  • 16. 13.10 FRIENDS FUNCTION :- A function that allow to access the private and protected members of a particular class from outside the class. :- Normally private and protected member of any cannot be accessed from outside the class. :- It enable the function to access the private and protected members of Both