SlideShare a Scribd company logo
Er Kabita Parajuli
Object-Oriented
Programming(OOP)
Lecture 1
1
Course Contents
What Procedural Oriented Programming Language?
What is OOP?
Introduction to OOP
Introduction to C++ programming
Classes and Object
Principles of Object Oriented programming
1. Inheritance
2. polymorphism
3. Encapsulation
4. Data abstraction
Benefits of object oriented Programming
2
What is Procedural
Programming Languages?
• Is standard programming approach,
used by language such as C,Fortran
and Basic.
• Tells computer “what to do?” and
“How to do it ?”
• involves the steps that must be
followed to accomplished a specified
tasks .
Fig: Typical Structure of Procedure Oriented Programs
3
The programming paradigm for procedural programming language is
1. Decide which procedure you want:
2. use the best algorithm you can find.
we can say the procedure programming language focuses on algorithm or procedure
to perform a particular job.
Large programs are divided into smaller programs called functions.
Data move openly around the system from function to functions.
4
int main(){
int a;
int b;
printf(“enter first value n”);
scanf(“%d”,&a);
printf(“enter second value n”);
scanf(%d”, &b);
………
}
5
• Step by Step entry of list of
instruction.
And this approach was called Structural
or procedural programming
languages where instructions was
passed in certain procedure.
Growing Complexity and size code
there need somthing more
convenient and there start OOP.
What is Object-Oriented Programming?
The OOP programming approach is based on fundamental concepts of class and
object.
OOP allows decomposition of a problem into a number of entities called objects and
then builds data and functions around these objects.
There are many object-oriented programming languages including JavaScript, C++,
Java, and Python.
6
Introduction to OOP
It is programming style which is associated with concepts of class and object
and various other concepts like:
1. Inheritance
2. polymorphism
3. abstraction
4. Encapsulation etc
Program are divided into small modules known as classes.
Function and data are tied together in an object.
7
8
Introduction to C++
• C++ is a general purpose programming language that was developed as the
enhancement of the C language t include object-oriented paradigm. The basics
syntax and code structure of both C and C++ are the same.
• C++ was developed by Bjarne Stroustrup at bell lab in 1979 and commonly called as
“C with Classes”
• It is simple language that program can be divided down into logical units and parts
has rid library support and variety of data types.
• C++ supports the four primary features of OOP : encapsulation, polymorphism,
abstraction, and inheritance.
• A function is a minimum requirement for a C++ program to run.
9
• the program to display message “welcome to c++!!” in screen using c++ can be
written as :
#include <iostream.h>
void main()
{
cout<<“welcome to c++!!”;
}
10
Classes
A class represent the group of objects that share common properties, behavior and
relationships.
It is an abstract blueprint used to create more specific, concrete objects.
For examples: The name ‘Computer’ can be class that represent personal
computer, lab computer and computer with similar characteristics.
Thus a class is an identifier which is general name i.e family/group name defined to
represent object of similar characteristics.
11
What does a class define
ATTRIBUTES
• name
• height
• weight
• gender
• age
BEHAVIOUR
• Walk
• run
• jump
• speak
• sleep
• Attributes are characteristics described by the class
and behavior describe what a class can do.
• For example If we are describing the class person
then its attributes are name height weight then its
behavior is walk run jump and so on.
• Attributes and Behavior in most of case are describes
as properties and methods .
• Class is describing them in a abstract i.e if class say a
person has a name and has height but does not say
what a name is because a class is description of
something
PROPERTIES
• name
• height
• weight
• gender
• age
METHODS
• Walk
• run
• jump
• speak
• sleep
12
• A class definition starts with keywords class followed by class name; and class body , enclosed by a pair of curly braces. It
must be followed by semicolon at the end.
class class_name
{
private:
variable declaration;
function declaration;
public:
variable declaration;
function declaration;
protected:
variable declaration;
function declaration;
};
Declaration of class
13
Objects
• An object is a real world entity with some characteristics and behavior. The world is
full of object such as pen, lamp, house, car, dog, cat and so on.
• Each object has unique identity and a states.The states of an object is define by
member variables.The object behaviors is defined by its member methods.
• It is an instances of classes .Creating the object is like defining a variable of a data
type.
• Once the class has been declared, we can create variables of that type by using the
class name.
• An object does not exits until the class has been created ; the class is just definition.
14
when a object is physically created, space for that object is allocated in primary
memory. It is possible to have multiple object of the class.
syntax of creating object:
class_name object_name;
e.g.
Box b1; // assume box as a box name
the statement Box b1; creates a variable b1 of type Box.The variable b1 is known as
object of the class Box. Thus, class variables are known was object.
We can create multiple object of the class as follows:
Box b1, b2, b3 ;
Syntax of creating the object
15
Principles of Object Oriented Programming
• The OOP programming is based on the four major fundamental principles.The OOP
principles includes:
1. Encapsulation
2. Inheritance
3. Abstraction
4. Polymorphism
16
Principles of OOP
17
1. Inheritance
• The inheritance is the process of acquiring the existing functionality odf the parent
class and adding additional features and functionality in to zither inherited child class.
• It is the process of deriving one class from another class. The existing class is known
as base class, super class or parent class and the newly created class is known as
derived class, child class and sub class.
• The derived class inherits all the features, expect private members inherent in the
base class.Inheritance supports the properties of code resuability and reliability
18
For examples
We can create base class named FRUIT and
define derived class as MANGO, ORANGE,
BANANA etc.
Each of them have common characteristics
like taste, price and season. The common
characteristic are in Base class. Each of the
characteristics are in derived class with
additional features or attributes.
MANGO would have its own defined feature,
ORANGE would have its own features and
BANANA would have its owns feature and so
on .
Figure:Child classes of the classes
Single Inheritance
Types of Inheritance
Multilevel
Inheritance
Hybrid
Inheritance
Multiple
Inheritance
20
2. Polymorphism
• The word poly means many and morphe means forms.
• Polymorphism means the ability to take more than one form.
• The function overloading, operator overloading, function overriding, virtual function
are the examples of polymorphism.
• In function overloading two or more functions have same name but with different
parameters are used.
• In function overriding, two or more function, with same name and same parameter but
one defined in base class and other in child class are used.
21
22
• The polymorphism can be defined
ass singe object as single object
with multiple behavior.
• the common use of polymorphism in
OOP occurs when a parent class
reference is used to refer to a child
class object.
• the common and simple use of
polymorphism in OOP program is
the use of same method name.
• For example, define many method
with same method name but
different implementation.
The process of binding the data and
methods together as a single unit is
referred as encapsulation.
It prevents the data from
unauthorized use from other parts of
program.
23
3. Encapsulation
• Mechanism to hide the member of the class and providing the access to only some of
them.
• We can make member of class private , public and protected. The outside world
cannot access those member which have been made private and the public member
can be accessed from the class as well was from outside the class.
• In this way class can hide some member from outside the world and provide the
security to them.
Data Hiding
24
4. Data Abstraction
• Abstraction refers as an act of representing essential features with out including
background details or explanation.
• It is methodology that supports use of compound or complex object without its detail
knowledge
• simply it refers to hiding the complexity.
• For examples
• A Class car is made up of an engine, gearbox, steering object and many more
components of the car work internally but only how the interface with them i.e
message to them ,receiving message from them
25
Benefits of Object Oriented languages
Better code reusability using object and inheritance.
Principles of data hiding helps build secure system.
Multiple objects can coexist without any interference.
Software complexity can be easily managed.
26
27
Thank You

More Related Content

What's hot

Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
AyanaRukasar
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
Darpan Chelani
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Languagedheva B
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented ProgrammingAida Ramlan II
 
Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
ppd1961
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Amit Soni (CTFL)
 
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
 
concept of oops
concept of oopsconcept of oops
concept of oops
prince sharma
 
Object-Oriented Programming Concepts
Object-Oriented Programming ConceptsObject-Oriented Programming Concepts
Object-Oriented Programming Concepts
Kwangshin Oh
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
Arnab Bhaumik
 
OOPS Basics With Example
OOPS Basics With ExampleOOPS Basics With Example
OOPS Basics With Example
Thooyavan Venkatachalam
 
Python-Polymorphism.pptx
Python-Polymorphism.pptxPython-Polymorphism.pptx
Python-Polymorphism.pptx
Karudaiyar Ganapathy
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop Kumar
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Nadeesha Thilakarathne
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
Power point presentation on access specifier in OOPs
Power point presentation on access specifier in OOPsPower point presentation on access specifier in OOPs
Power point presentation on access specifier in OOPs
AdrizaBera
 
Oop java
Oop javaOop java
Oop java
Minal Maniar
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
baabtra.com - No. 1 supplier of quality freshers
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Iqra khalil
 

What's hot (20)

Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented Programming
 
Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
Object-Oriented Programming Concepts
Object-Oriented Programming ConceptsObject-Oriented Programming Concepts
Object-Oriented Programming Concepts
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
OOPS Basics With Example
OOPS Basics With ExampleOOPS Basics With Example
OOPS Basics With Example
 
Python-Polymorphism.pptx
Python-Polymorphism.pptxPython-Polymorphism.pptx
Python-Polymorphism.pptx
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Power point presentation on access specifier in OOPs
Power point presentation on access specifier in OOPsPower point presentation on access specifier in OOPs
Power point presentation on access specifier in OOPs
 
Oop java
Oop javaOop java
Oop java
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 

Similar to oop.pptx

Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
colleges
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
LakshyaChauhan21
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
daxesh chauhan
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptx
PadmaN24
 
Oops and c fundamentals
Oops and c fundamentals Oops and c fundamentals
Oops and c fundamentals
umesh patil
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++
KAUSHAL KUMAR JHA
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
SamuelAnsong6
 
Oop ppt
Oop pptOop ppt
Oop ppt
Shani Manjara
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
Amar Jukuntla
 
java oops compilation object class inheritance.pptx
java oops compilation object class inheritance.pptxjava oops compilation object class inheritance.pptx
java oops compilation object class inheritance.pptx
CHERUKURIYUVARAJU209
 
introduction of Object oriented programming
introduction of Object oriented programmingintroduction of Object oriented programming
introduction of Object oriented programming
RiturajJain8
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Saiful Islam Sany
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
tuyambazejeanclaude
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
YashKoli22
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
sharmisivarajah
 
130704798265658191
130704798265658191130704798265658191
130704798265658191
Tanzeel Ahmad
 
java introduction features and propertie
java introduction features and propertiejava introduction features and propertie
java introduction features and propertie
SanaMateen7
 

Similar to oop.pptx (20)

Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptx
 
Oops and c fundamentals
Oops and c fundamentals Oops and c fundamentals
Oops and c fundamentals
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
 
Oop ppt
Oop pptOop ppt
Oop ppt
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
M.c.a (sem iii) paper - i - object oriented programming
M.c.a (sem   iii) paper - i - object oriented programmingM.c.a (sem   iii) paper - i - object oriented programming
M.c.a (sem iii) paper - i - object oriented programming
 
java oops compilation object class inheritance.pptx
java oops compilation object class inheritance.pptxjava oops compilation object class inheritance.pptx
java oops compilation object class inheritance.pptx
 
introduction of Object oriented programming
introduction of Object oriented programmingintroduction of Object oriented programming
introduction of Object oriented programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
130704798265658191
130704798265658191130704798265658191
130704798265658191
 
java introduction features and propertie
java introduction features and propertiejava introduction features and propertie
java introduction features and propertie
 

Recently uploaded

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 

Recently uploaded (20)

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 

oop.pptx

  • 2. Course Contents What Procedural Oriented Programming Language? What is OOP? Introduction to OOP Introduction to C++ programming Classes and Object Principles of Object Oriented programming 1. Inheritance 2. polymorphism 3. Encapsulation 4. Data abstraction Benefits of object oriented Programming 2
  • 3. What is Procedural Programming Languages? • Is standard programming approach, used by language such as C,Fortran and Basic. • Tells computer “what to do?” and “How to do it ?” • involves the steps that must be followed to accomplished a specified tasks . Fig: Typical Structure of Procedure Oriented Programs 3
  • 4. The programming paradigm for procedural programming language is 1. Decide which procedure you want: 2. use the best algorithm you can find. we can say the procedure programming language focuses on algorithm or procedure to perform a particular job. Large programs are divided into smaller programs called functions. Data move openly around the system from function to functions. 4
  • 5. int main(){ int a; int b; printf(“enter first value n”); scanf(“%d”,&a); printf(“enter second value n”); scanf(%d”, &b); ……… } 5 • Step by Step entry of list of instruction. And this approach was called Structural or procedural programming languages where instructions was passed in certain procedure. Growing Complexity and size code there need somthing more convenient and there start OOP.
  • 6. What is Object-Oriented Programming? The OOP programming approach is based on fundamental concepts of class and object. OOP allows decomposition of a problem into a number of entities called objects and then builds data and functions around these objects. There are many object-oriented programming languages including JavaScript, C++, Java, and Python. 6
  • 7. Introduction to OOP It is programming style which is associated with concepts of class and object and various other concepts like: 1. Inheritance 2. polymorphism 3. abstraction 4. Encapsulation etc Program are divided into small modules known as classes. Function and data are tied together in an object. 7
  • 8. 8
  • 9. Introduction to C++ • C++ is a general purpose programming language that was developed as the enhancement of the C language t include object-oriented paradigm. The basics syntax and code structure of both C and C++ are the same. • C++ was developed by Bjarne Stroustrup at bell lab in 1979 and commonly called as “C with Classes” • It is simple language that program can be divided down into logical units and parts has rid library support and variety of data types. • C++ supports the four primary features of OOP : encapsulation, polymorphism, abstraction, and inheritance. • A function is a minimum requirement for a C++ program to run. 9
  • 10. • the program to display message “welcome to c++!!” in screen using c++ can be written as : #include <iostream.h> void main() { cout<<“welcome to c++!!”; } 10
  • 11. Classes A class represent the group of objects that share common properties, behavior and relationships. It is an abstract blueprint used to create more specific, concrete objects. For examples: The name ‘Computer’ can be class that represent personal computer, lab computer and computer with similar characteristics. Thus a class is an identifier which is general name i.e family/group name defined to represent object of similar characteristics. 11
  • 12. What does a class define ATTRIBUTES • name • height • weight • gender • age BEHAVIOUR • Walk • run • jump • speak • sleep • Attributes are characteristics described by the class and behavior describe what a class can do. • For example If we are describing the class person then its attributes are name height weight then its behavior is walk run jump and so on. • Attributes and Behavior in most of case are describes as properties and methods . • Class is describing them in a abstract i.e if class say a person has a name and has height but does not say what a name is because a class is description of something PROPERTIES • name • height • weight • gender • age METHODS • Walk • run • jump • speak • sleep 12
  • 13. • A class definition starts with keywords class followed by class name; and class body , enclosed by a pair of curly braces. It must be followed by semicolon at the end. class class_name { private: variable declaration; function declaration; public: variable declaration; function declaration; protected: variable declaration; function declaration; }; Declaration of class 13
  • 14. Objects • An object is a real world entity with some characteristics and behavior. The world is full of object such as pen, lamp, house, car, dog, cat and so on. • Each object has unique identity and a states.The states of an object is define by member variables.The object behaviors is defined by its member methods. • It is an instances of classes .Creating the object is like defining a variable of a data type. • Once the class has been declared, we can create variables of that type by using the class name. • An object does not exits until the class has been created ; the class is just definition. 14
  • 15. when a object is physically created, space for that object is allocated in primary memory. It is possible to have multiple object of the class. syntax of creating object: class_name object_name; e.g. Box b1; // assume box as a box name the statement Box b1; creates a variable b1 of type Box.The variable b1 is known as object of the class Box. Thus, class variables are known was object. We can create multiple object of the class as follows: Box b1, b2, b3 ; Syntax of creating the object 15
  • 16. Principles of Object Oriented Programming • The OOP programming is based on the four major fundamental principles.The OOP principles includes: 1. Encapsulation 2. Inheritance 3. Abstraction 4. Polymorphism 16
  • 18. 1. Inheritance • The inheritance is the process of acquiring the existing functionality odf the parent class and adding additional features and functionality in to zither inherited child class. • It is the process of deriving one class from another class. The existing class is known as base class, super class or parent class and the newly created class is known as derived class, child class and sub class. • The derived class inherits all the features, expect private members inherent in the base class.Inheritance supports the properties of code resuability and reliability 18
  • 19. For examples We can create base class named FRUIT and define derived class as MANGO, ORANGE, BANANA etc. Each of them have common characteristics like taste, price and season. The common characteristic are in Base class. Each of the characteristics are in derived class with additional features or attributes. MANGO would have its own defined feature, ORANGE would have its own features and BANANA would have its owns feature and so on . Figure:Child classes of the classes
  • 20. Single Inheritance Types of Inheritance Multilevel Inheritance Hybrid Inheritance Multiple Inheritance 20
  • 21. 2. Polymorphism • The word poly means many and morphe means forms. • Polymorphism means the ability to take more than one form. • The function overloading, operator overloading, function overriding, virtual function are the examples of polymorphism. • In function overloading two or more functions have same name but with different parameters are used. • In function overriding, two or more function, with same name and same parameter but one defined in base class and other in child class are used. 21
  • 22. 22 • The polymorphism can be defined ass singe object as single object with multiple behavior. • the common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. • the common and simple use of polymorphism in OOP program is the use of same method name. • For example, define many method with same method name but different implementation.
  • 23. The process of binding the data and methods together as a single unit is referred as encapsulation. It prevents the data from unauthorized use from other parts of program. 23 3. Encapsulation
  • 24. • Mechanism to hide the member of the class and providing the access to only some of them. • We can make member of class private , public and protected. The outside world cannot access those member which have been made private and the public member can be accessed from the class as well was from outside the class. • In this way class can hide some member from outside the world and provide the security to them. Data Hiding 24
  • 25. 4. Data Abstraction • Abstraction refers as an act of representing essential features with out including background details or explanation. • It is methodology that supports use of compound or complex object without its detail knowledge • simply it refers to hiding the complexity. • For examples • A Class car is made up of an engine, gearbox, steering object and many more components of the car work internally but only how the interface with them i.e message to them ,receiving message from them 25
  • 26. Benefits of Object Oriented languages Better code reusability using object and inheritance. Principles of data hiding helps build secure system. Multiple objects can coexist without any interference. Software complexity can be easily managed. 26