SlideShare a Scribd company logo
Object Oriented Programming
Engr. Muhammad Fiaz
Lecture # 01
Object Oriented Programming National College of Business Administration & Economics 1
Object Oriented
Programming
Objects
Classes
Constructors
Static Data Member
Today’s Agenda
Object Oriented Programming National College of Business Administration & Economics 2
01
02
03
05
06
07
Creating Objects
04 08
Destructor
Static Functions
Object-Oriented Programming
• Object Oriented Programming (OOP) is a programming technique
in which programs are written on the basis of objects.
• An object is a collection of data and functions. Object may
represent a person, thing or place in real world.
• In OOP data and all possible functions on data are grouped
together.
• Object oriented programs are easier to learn and modify.
• Object-Oriented Programming is a powerful technique to
develop software.
• It is used to analyze and design applications in terms of
objects.
3
National College of Business Administration & Economics
Object Oriented Programming
Features of Object Oriented Programming
• Following are some features of Object-Oriented
Programming:
• Objects
• Classes
• Real-World Modeling
• Reusability
• Information Hiding
• Polymorphism
4
National College of Business Administration & Economics
Object Oriented Programming
Objects
• An Object represents an entity in real world such as
person, thing or concept etc.
• An object is identified by its name.
• An object consists of two things
• Properties are the characteristics of an object.
• Functions are the action that can be performed by an
object.
5
National College of Business Administration & Economics
Object Oriented Programming
Properties and Functions of an
Object
6
National College of Business Administration & Economics
Object Oriented Programming
Properties Functions
The characteristics of and
objects are known as its
properties or attributes.
The actions that can be
performed by an object are
known as functions.
Each object has its own
properties.
An object can perform
different tasks and actions.
Properties can be used to
describe the object.
Functions can help describe
the functionality of the
object.
Classes
• A collection of objects with same properties and
functions is known as Class.
• A class is used to define the characteristics of the
objects.
• It is used as a model for creating different objects of
same type.
• Each object of a class is known as an instance of its
class.
7
National College of Business Administration & Economics
Object Oriented Programming
Declaring a Class
• A class is declared in the same as a structure is
declared.
• The key word class is used to declare a class.
• The functions declared in a class are called member
functions.
• Syntax
class identifier
{
body of the class
};
8
National College of Business Administration & Economics
Object Oriented Programming
Access Specifiers
• The Commands that are used to specify the access level
of class members are known as access specifiers.
• Two most important access specifiers are the ‘Private’
and the ‘Public’ Access Specifier.
9
National College of Business Administration & Economics
Object Oriented Programming
Private Access Specifier
• The private access specifier is used to restrict the
use of class member within the class.
• Any member of the class declared with private access
specifier can only be accessed within the class.
• It cannot be accessed from outsider the class.
• It is also the default access specifier.
• The data members are normally declared with private
access specifier.
• It is because the data of an object is more sensitive.
10
National College of Business Administration & Economics
Object Oriented Programming
Public Access Specifier
• The Public access specifier is used to allow the user
to access a class member within the class as well as
outside the class.
• Any member of the class declared with public access
specifier can be accessed from anywhere in the program.
• The members function are normally declared with public
access specifier.
• It is because the users access functions of an object
from outside the class.
• Unlike Private Access Specifier, Public Access
Specifier is not Default.
11
National College of Business Administration & Economics
Object Oriented Programming
Creating Objects
• A class is simply a model or prototype for creating
objects.
• It is like a new data type that contains both data
and functions.
• An Object is created in the same way as other
variables are created.
• An object is also known as instance, the process of
creating an object a class is also instantiation.
• Syntax:
class_name object_name;
12
National College of Business Administration & Economics
Object Oriented Programming
Constructors
• A Type of member function that is automatically
executed when an object of that class is created is
known as constructor.
• The constructor has no return type and has same
name that of class name.
• The constructor can work as a normal function but
it cannot return any value.
• It is normally Defined in classes to initialize
data member.
13
National College of Business Administration & Economics
Object Oriented Programming
Important Points about
Constructor
• It has no return type.
• It has the same name as of the class.
• It may or may not have any arguments.
• It is used to initialize data members.
• it is automatically executed when the object of
that class is created.
14
National College of Business Administration & Economics
Object Oriented Programming
Constructor Overloading
• The process of declaring multiple constructors with
same name but different parameters is known as
constructor overloading.
• The constructors with same name must differ in one
of the following:
1. Number of parameters
2. Types of parameters
3. Sequence of parameters
15
National College of Business Administration & Economics
Object Oriented
Programming
Destructors
• A type of member function that is automatically
executed when an object of that class is destroyed
is know as destructor.
• The destructor has no return type.
• It has the same name as class name.
• The Destructor cannot return any value.
• It also cannot accept any parameters.
• The destructor name is preceded by tilde sign ~.
16
National College of Business Administration & Economics
Object Oriented
Programming
Syntax of Destructors
• The syntax of declaring destructor is as follows:
~name()
{
destructor body
}
17
National College of Business Administration & Economics
Object Oriented
Programming
Static Data Members
• A type of data member that is share among all objects
of class is known as static data member.
• The static data member is defined in the class with
static keyword.
• When a data member is defined as static, only one
variable is created in the memory even if are more
objects.
• The Characteristics of a static data member are same as
normal static variable.
• It is visible only in the class in which it is defined.
• It is normally use to share some data among all
objects.
18
National College of Business Administration & Economics
Object Oriented
Programming
Static Functions
• A type of member function that can be accessed without
any object of the class is called static function.
• The static data members of a class are not created for
each object.
• The class creates only one data member for all objects.
• The static data member is defined when the program is
executed.
• The program may require to access a static data member
before creating an object.
• The static member functions can be used to access a
static data member.
19
National College of Business Administration & Economics
Object Oriented
Programming
THANK YOU!
Do you have any questions?
20
ENGR. MUHAMMAD FIAZ
PEC REGISTERED ENGINEER
LECTURER COMPUTER SCIENCE
TELF/EF SET / ACEPT CERTIFIED
MICROSOFT ACADEMY TRAINER
ORACLE CERTIFIED PROFESSIONAL
GOOGLE CERTIFIED PROFESSIONAL
Lahore, Pakistan
+92-336-678-2755
muhammadfiaz@ncbae.edu.pk
https://www.linkedin/in/fiazofficials
National College of Business Administration & Economics
Object Oriented Programming

More Related Content

Similar to 1_Object Oriented Programming.pptx

Chapter 1
Chapter 1Chapter 1
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
Saket Khopkar
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)
Nuzhat Memon
 
Presentation c
Presentation cPresentation c
Presentation c
Kunal Sharma
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
anitashinde33
 
CPP16 - Object Design
CPP16 - Object DesignCPP16 - Object Design
CPP16 - Object Design
Michael Heron
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
jayeshsoni49
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
LakshyaChauhan21
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
MD Sulaiman
 
80410172053.pdf
80410172053.pdf80410172053.pdf
80410172053.pdf
WrushabhShirsat3
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
Michael Heron
 
[OOP - Lec 02] Why do we need OOP
[OOP - Lec 02] Why do we need OOP[OOP - Lec 02] Why do we need OOP
[OOP - Lec 02] Why do we need OOP
Muhammad Hammad Waseem
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
Geophery sanga
 
Tools-and-Techniques-for-Basic-Administration-vFinal3.pptx
Tools-and-Techniques-for-Basic-Administration-vFinal3.pptxTools-and-Techniques-for-Basic-Administration-vFinal3.pptx
Tools-and-Techniques-for-Basic-Administration-vFinal3.pptx
indupriya93
 
C++ training
C++ training C++ training
C++ training
PL Sharma
 
1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt
AqeelAbbas94
 
Lecture#5.pptx
Lecture#5.pptxLecture#5.pptx
Lecture#5.pptx
GulRana13
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
Michael Heron
 

Similar to 1_Object Oriented Programming.pptx (20)

C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)
 
Presentation c
Presentation cPresentation c
Presentation c
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
 
CPP16 - Object Design
CPP16 - Object DesignCPP16 - Object Design
CPP16 - Object Design
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
80410172053.pdf
80410172053.pdf80410172053.pdf
80410172053.pdf
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
 
[OOP - Lec 02] Why do we need OOP
[OOP - Lec 02] Why do we need OOP[OOP - Lec 02] Why do we need OOP
[OOP - Lec 02] Why do we need OOP
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
 
Tools-and-Techniques-for-Basic-Administration-vFinal3.pptx
Tools-and-Techniques-for-Basic-Administration-vFinal3.pptxTools-and-Techniques-for-Basic-Administration-vFinal3.pptx
Tools-and-Techniques-for-Basic-Administration-vFinal3.pptx
 
C++ training
C++ training C++ training
C++ training
 
1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt
 
Lecture#5.pptx
Lecture#5.pptxLecture#5.pptx
Lecture#5.pptx
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
 

Recently uploaded

Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 

Recently uploaded (20)

Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 

1_Object Oriented Programming.pptx

  • 1. Object Oriented Programming Engr. Muhammad Fiaz Lecture # 01 Object Oriented Programming National College of Business Administration & Economics 1
  • 2. Object Oriented Programming Objects Classes Constructors Static Data Member Today’s Agenda Object Oriented Programming National College of Business Administration & Economics 2 01 02 03 05 06 07 Creating Objects 04 08 Destructor Static Functions
  • 3. Object-Oriented Programming • Object Oriented Programming (OOP) is a programming technique in which programs are written on the basis of objects. • An object is a collection of data and functions. Object may represent a person, thing or place in real world. • In OOP data and all possible functions on data are grouped together. • Object oriented programs are easier to learn and modify. • Object-Oriented Programming is a powerful technique to develop software. • It is used to analyze and design applications in terms of objects. 3 National College of Business Administration & Economics Object Oriented Programming
  • 4. Features of Object Oriented Programming • Following are some features of Object-Oriented Programming: • Objects • Classes • Real-World Modeling • Reusability • Information Hiding • Polymorphism 4 National College of Business Administration & Economics Object Oriented Programming
  • 5. Objects • An Object represents an entity in real world such as person, thing or concept etc. • An object is identified by its name. • An object consists of two things • Properties are the characteristics of an object. • Functions are the action that can be performed by an object. 5 National College of Business Administration & Economics Object Oriented Programming
  • 6. Properties and Functions of an Object 6 National College of Business Administration & Economics Object Oriented Programming Properties Functions The characteristics of and objects are known as its properties or attributes. The actions that can be performed by an object are known as functions. Each object has its own properties. An object can perform different tasks and actions. Properties can be used to describe the object. Functions can help describe the functionality of the object.
  • 7. Classes • A collection of objects with same properties and functions is known as Class. • A class is used to define the characteristics of the objects. • It is used as a model for creating different objects of same type. • Each object of a class is known as an instance of its class. 7 National College of Business Administration & Economics Object Oriented Programming
  • 8. Declaring a Class • A class is declared in the same as a structure is declared. • The key word class is used to declare a class. • The functions declared in a class are called member functions. • Syntax class identifier { body of the class }; 8 National College of Business Administration & Economics Object Oriented Programming
  • 9. Access Specifiers • The Commands that are used to specify the access level of class members are known as access specifiers. • Two most important access specifiers are the ‘Private’ and the ‘Public’ Access Specifier. 9 National College of Business Administration & Economics Object Oriented Programming
  • 10. Private Access Specifier • The private access specifier is used to restrict the use of class member within the class. • Any member of the class declared with private access specifier can only be accessed within the class. • It cannot be accessed from outsider the class. • It is also the default access specifier. • The data members are normally declared with private access specifier. • It is because the data of an object is more sensitive. 10 National College of Business Administration & Economics Object Oriented Programming
  • 11. Public Access Specifier • The Public access specifier is used to allow the user to access a class member within the class as well as outside the class. • Any member of the class declared with public access specifier can be accessed from anywhere in the program. • The members function are normally declared with public access specifier. • It is because the users access functions of an object from outside the class. • Unlike Private Access Specifier, Public Access Specifier is not Default. 11 National College of Business Administration & Economics Object Oriented Programming
  • 12. Creating Objects • A class is simply a model or prototype for creating objects. • It is like a new data type that contains both data and functions. • An Object is created in the same way as other variables are created. • An object is also known as instance, the process of creating an object a class is also instantiation. • Syntax: class_name object_name; 12 National College of Business Administration & Economics Object Oriented Programming
  • 13. Constructors • A Type of member function that is automatically executed when an object of that class is created is known as constructor. • The constructor has no return type and has same name that of class name. • The constructor can work as a normal function but it cannot return any value. • It is normally Defined in classes to initialize data member. 13 National College of Business Administration & Economics Object Oriented Programming
  • 14. Important Points about Constructor • It has no return type. • It has the same name as of the class. • It may or may not have any arguments. • It is used to initialize data members. • it is automatically executed when the object of that class is created. 14 National College of Business Administration & Economics Object Oriented Programming
  • 15. Constructor Overloading • The process of declaring multiple constructors with same name but different parameters is known as constructor overloading. • The constructors with same name must differ in one of the following: 1. Number of parameters 2. Types of parameters 3. Sequence of parameters 15 National College of Business Administration & Economics Object Oriented Programming
  • 16. Destructors • A type of member function that is automatically executed when an object of that class is destroyed is know as destructor. • The destructor has no return type. • It has the same name as class name. • The Destructor cannot return any value. • It also cannot accept any parameters. • The destructor name is preceded by tilde sign ~. 16 National College of Business Administration & Economics Object Oriented Programming
  • 17. Syntax of Destructors • The syntax of declaring destructor is as follows: ~name() { destructor body } 17 National College of Business Administration & Economics Object Oriented Programming
  • 18. Static Data Members • A type of data member that is share among all objects of class is known as static data member. • The static data member is defined in the class with static keyword. • When a data member is defined as static, only one variable is created in the memory even if are more objects. • The Characteristics of a static data member are same as normal static variable. • It is visible only in the class in which it is defined. • It is normally use to share some data among all objects. 18 National College of Business Administration & Economics Object Oriented Programming
  • 19. Static Functions • A type of member function that can be accessed without any object of the class is called static function. • The static data members of a class are not created for each object. • The class creates only one data member for all objects. • The static data member is defined when the program is executed. • The program may require to access a static data member before creating an object. • The static member functions can be used to access a static data member. 19 National College of Business Administration & Economics Object Oriented Programming
  • 20. THANK YOU! Do you have any questions? 20 ENGR. MUHAMMAD FIAZ PEC REGISTERED ENGINEER LECTURER COMPUTER SCIENCE TELF/EF SET / ACEPT CERTIFIED MICROSOFT ACADEMY TRAINER ORACLE CERTIFIED PROFESSIONAL GOOGLE CERTIFIED PROFESSIONAL Lahore, Pakistan +92-336-678-2755 muhammadfiaz@ncbae.edu.pk https://www.linkedin/in/fiazofficials National College of Business Administration & Economics Object Oriented Programming

Editor's Notes

  1. © Copyright Showeet.com – Free PowerPoint Templates
  2. © Copyright Showeet.com – Free PowerPoint Templates
  3. © Copyright Showeet.com – Free PowerPoint Templates
  4. © Copyright Showeet.com – Free PowerPoint Templates
  5. © Copyright Showeet.com – Free PowerPoint Templates
  6. © Copyright Showeet.com – Free PowerPoint Templates
  7. © Copyright Showeet.com – Free PowerPoint Templates
  8. © Copyright Showeet.com – Free PowerPoint Templates
  9. © Copyright Showeet.com – Free PowerPoint Templates
  10. © Copyright Showeet.com – Free PowerPoint Templates
  11. © Copyright Showeet.com – Free PowerPoint Templates
  12. © Copyright Showeet.com – Free PowerPoint Templates
  13. © Copyright Showeet.com – Free PowerPoint Templates
  14. © Copyright Showeet.com – Free PowerPoint Templates
  15. © Copyright Showeet.com – Free PowerPoint Templates
  16. © Copyright Showeet.com – Free PowerPoint Templates
  17. © Copyright Showeet.com – Free PowerPoint Templates
  18. © Copyright Showeet.com – Free PowerPoint Templates
  19. © Copyright Showeet.com – Free PowerPoint Templates
  20. © Copyright Showeet.com – Free PowerPoint Templates