SlideShare ist ein Scribd-Unternehmen logo
1 von 26
OBJECT ORIENTED PROGRAMING
{OOP}
BY SANGA G,
OOP ITRODUCTION
• What is object oriented programming?
Object-oriented programming (OOP) is a way to
organize and conceptualize a program as a set
of interacting objects.
• The programmer defines the types of objects
that will exist.
• The programmer creates object instances as
they are needed.
OOP CONT………….
• The programmer specifies how these various
object will communicate and interact with each
other.
• Object-oriented programming is a methodology
that gives programmers tools to make this
modeling process easier.
• Simply we can say Object-oriented
programming, or OOP, is an approach to problem
solving where all computations are carried out
using objects.
TEMINOLOGIES USED IN OOP
• Object
• Class
• Instance
• Inheritance
• Encapsulation
• Abstraction
• Polymorphism
• Overloading
Object
• An object is a component of a program that
knows how to perform certain actions and
how to interact with other elements of the
program.
• An object contains both data and methods
that manipulate that data
– An object is active, not passive; (it does things)
– An object is responsible for its own data
Object
• Code in object-oriented programming is organized
around objects. Once you have your objects, they can
interact with each other to make something happen
• Let's say you want to have a program where a person
gets into a car and drives it from A to B. You would
start by describing the objects, such as a person and
car. That includes methods: a person knows how to
drive a car and a car knows what it is like to be driven.
Once you have your objects, you bring them together
so the person can get into the car and drive.
Class
• A class is a blueprint or template or set of
instructions to build a specific type of object.
or
• class is the generic definition for a set of
similar objects
• A class can be thought of as a template used
to create a set of objects.
• A class is a static definition; a piece of code
written in a programming language
Class
• So, let's say you want to use a person in your
program. You want to be able to describe the
person and have the person do something. A
class called 'person' would provide a blueprint
for what a person looks like and what a person
can do. To actually use a person in your
program you need to create an object. You use
the person class to create an object of the
type 'person.' Now you can describe this
person and have it do something.
Class
A class is a statement
class ClassVariable
attr
AttrName1
:
AttrNameN
meth Pattern1 Statement end
:
meth PatternN Statement end
end
Instance
• An instance is a realization of a particular item of a class. In
other words, an instance is an instantiation of a class. All
the instances of a class have similar properties, as
described in the class definition. For example, you can
define a class called "Student" and create three instances
of the class "Student" for "Peter", "Paul" and "Pauline".
• The term "object" usually refers to instance. But it is often
used loosely, and may refer to a class or an instance.
• instance is a concrete occurrence of any object, existing
usually during the runtime of a computer program
Example of instance
For examples, suppose that we have a class called Circle, we can create
instances of Circle as follows:
// Declare 3 instances of the class Circle, c1, c2, and c3
Circle c1, c2, c3; // They hold a special value called null
// Construct the instances via new operator
c1 = new Circle();
c2 = new Circle(2.0);
c3 = new Circle(3.0, "red");
// You can Declare and Construct in the same statement Circle
c4 = new Circle();
Inheritance
• Inheritance
• Inheritance is the process of forming a new
class from an existing class that is from the
existing class called as base class, new class is
formed called as derived class.
• This is a very important concept of object-
oriented programming since this feature helps
to reduce the code size.
Example
// A class to display the attributes of the vehicle
class Vehicle {
String color;
int speed;
int size;
void attributes() {
System.out.println("Color : " + color);
System.out.println("Speed : " + speed);
System.out.println("Size : " + size);
}
}
// A subclass which extends for vehicle class
Car extends Vehicle {
int CC;
int gears;
void attributescar() {
Example cont……
// The subclass refers to the members of the superclass
System.out.println("Color of Car : " + color);
System.out.println("Speed of Car : " + speed);
System.out.println("Size of Car : " + size);
System.out.println("CC of Car : " + CC);
System.out.println("No of gears of Car : " + gears);
}
}
public class Test {
public static void main(String args[]) {
Car b1 = new Car();
b1.color = "Blue";
b1.speed = 200 ;
b1.size = 22;
b1.CC = 1000;
b1.gears = 5;
b1.attributescar();
}
}
Encapsulation
• Encapsulation is placing the data and the
functions that work on that data in the same
place. While working with procedural
languages, it is not always clear which
functions work on which variables but object-
oriented programming provides you
framework to place the data and the relevant
functions together in the same object.
Benefits of Encapsulation
• Makes it easy to model real-world entities –
hence easy to understand and maintain
• Control the way data is accessed or modified
• Makes the class easy to use for clients
• Increase reusability
• Aids to the flexibility of design e.g. It is
possible to add accelerationConfiguration field
in the Car. This will enable you to have
different acceleration behaviour of each car.
Abstraction
• Polymorphism is the capability of a method to
do different things based on the object that it
is acting upon. In other words, polymorphism
allows you define one interface and have
multiple implementations
Overloading
• Overloading is ability of one function to
perform different tasks, i.e,it allows creating
several methods with the same name which
differ from each other in the type of the input
and the output of the function.
Private and public
• Public, means all the class members declared under public will be
available to everyone. The data members and member functions
declared public can be accessed by other classes too. Hence there
are chances that they might change them. So the key members
must not be declared public.
example
class PublicAccess
{
public:
// public access specifier
int x;
// Data Member Declaration
void display();
// Member Function decaration
}
Private
• Private , means that no one can access the
class members declared private outside that
class. If someone tries to access the private
member, they will get a compile time error. By
default class variables and member functions
are private.
Methods and properties of the class
• A method in object-oriented programming
(OOP) is a procedure associated with a
message and an object. An object is made up
of data and behavior, which form the interface
that an object presents to the outside world.
Data is represented as properties of the object
and behavior as methods. For example, a
Window object would have methods such as
open and close, while its state (whether it is
opened or closed) would be a property.
Class methods
• Class methods are methods that are called on
a class rather than an instance. They are
typically used as part of an object meta-
model. I.e, for each class defined an instance
of the class object in the meta-model is
created.
property
• property is a member of a class that plays an
intermediary role to a field of the class. For example, if
you have a field of class and that member represents
the salary of an employee, a property can be the
"door" that other classes that need the salary must
present their requests to. As such, these external
classes cannot just change the salary or retrieve it as
they wish. A property can be used to validate their
request, to reject or to accept them.
• A property is used to "filter" access to a field of a class.
Therefore, you start by declaring a (private (if you don't
make it private, you may be deceiving the purpose of
creating a property)) field
property
• A property is used to "filter" access to a field
of a class. Therefore, you start by declaring a
(private (if you don't make it private, you may
be deceiving the purpose of creating a
property)) field
• https://www3.ntu.edu.sg/home/ehchua/prog
ramming/java/J3a_OOPBasics.html
• https://processing.org/examples/inheritance.
html
• https://www.tutorialspoint.com/cplusplus/cp
p_data_encapsulation.htm

Weitere ähnliche Inhalte

Was ist angesagt?

Basic Concepts Of OOPS/OOPS in Java,C++
Basic Concepts Of OOPS/OOPS in Java,C++Basic Concepts Of OOPS/OOPS in Java,C++
Basic Concepts Of OOPS/OOPS in Java,C++Guneesh Basundhra
 
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
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming conceptPina Parmar
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Languagedheva B
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaMadishetty Prathibha
 
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
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming ConceptsAbhigyan Singh Yadav
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentationAyanaRukasar
 
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING Uttam Singh
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming pptNitesh Dubey
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)Muhammad Hammad Waseem
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#Adeel Rasheed
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented RelationshipsTaher Barodawala
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 

Was ist angesagt? (20)

Basic Concepts Of OOPS/OOPS in Java,C++
Basic Concepts Of OOPS/OOPS in Java,C++Basic Concepts Of OOPS/OOPS in Java,C++
Basic Concepts Of OOPS/OOPS in Java,C++
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented Programming
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
SEMINAR
SEMINARSEMINAR
SEMINAR
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
 
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
 
Oops
OopsOops
Oops
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)
 
What is OOP?
What is OOP?What is OOP?
What is OOP?
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#
 
Oops in Java
Oops in JavaOops in Java
Oops in Java
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 

Andere mochten auch

Object Oriented Programing - Intro
Object Oriented Programing - IntroObject Oriented Programing - Intro
Object Oriented Programing - IntroBayu Firmawan Paoh
 
Mofolojia ya kiswahili
Mofolojia ya kiswahiliMofolojia ya kiswahili
Mofolojia ya kiswahiliGeophery sanga
 
Project object explain your choice
Project object   explain your choiceProject object   explain your choice
Project object explain your choiceSoren
 
Inline function(oops)
Inline function(oops)Inline function(oops)
Inline function(oops)Jay Patel
 
Ge 249 SOPHISTS GROUP SAUT BUKOBA
Ge 249 SOPHISTS GROUP SAUT BUKOBA Ge 249 SOPHISTS GROUP SAUT BUKOBA
Ge 249 SOPHISTS GROUP SAUT BUKOBA Mwl. Mapesa Nestory
 
Uchumi wa kibiblia
Uchumi wa kibibliaUchumi wa kibiblia
Uchumi wa kibiblia001111111111
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts246paa
 
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPMudasir Qazi
 
OOPS features using Objective C
OOPS features using Objective COOPS features using Objective C
OOPS features using Objective CTiyasi Acharya
 
Dynamics Telephony Dialer Intro
Dynamics Telephony Dialer IntroDynamics Telephony Dialer Intro
Dynamics Telephony Dialer IntroEddie Steede
 
Object Oriented Programing - Inheritance
Object Oriented Programing - InheritanceObject Oriented Programing - Inheritance
Object Oriented Programing - InheritanceBayu Firmawan Paoh
 
Object Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismObject Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismBayu Firmawan Paoh
 
Water resources management river basin manage
Water resources management river basin manageWater resources management river basin manage
Water resources management river basin manageMwl. Mapesa Nestory
 
Futuristic programing language
Futuristic programing languageFuturistic programing language
Futuristic programing languageMohamed Zaki
 
Fursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogoFursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogoYSDO and MAP
 
Object Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptObject Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptAkshay Mathur
 
Jipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la SitaJipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la Sitakanguni
 

Andere mochten auch (20)

Object Oriented Programing - Intro
Object Oriented Programing - IntroObject Oriented Programing - Intro
Object Oriented Programing - Intro
 
Mofolojia ya kiswahili
Mofolojia ya kiswahiliMofolojia ya kiswahili
Mofolojia ya kiswahili
 
Project object explain your choice
Project object   explain your choiceProject object   explain your choice
Project object explain your choice
 
Inline function(oops)
Inline function(oops)Inline function(oops)
Inline function(oops)
 
Ge 249 SOPHISTS GROUP SAUT BUKOBA
Ge 249 SOPHISTS GROUP SAUT BUKOBA Ge 249 SOPHISTS GROUP SAUT BUKOBA
Ge 249 SOPHISTS GROUP SAUT BUKOBA
 
Uchumi wa kibiblia
Uchumi wa kibibliaUchumi wa kibiblia
Uchumi wa kibiblia
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOP
 
OOPS features using Objective C
OOPS features using Objective COOPS features using Objective C
OOPS features using Objective C
 
Dynamics Telephony Dialer Intro
Dynamics Telephony Dialer IntroDynamics Telephony Dialer Intro
Dynamics Telephony Dialer Intro
 
Object Oriented Programing - Inheritance
Object Oriented Programing - InheritanceObject Oriented Programing - Inheritance
Object Oriented Programing - Inheritance
 
Object Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismObject Oriented Programing - Polymrphism
Object Oriented Programing - Polymrphism
 
Water resources management river basin manage
Water resources management river basin manageWater resources management river basin manage
Water resources management river basin manage
 
Futuristic programing language
Futuristic programing languageFuturistic programing language
Futuristic programing language
 
Aspect Oriented Programing - Introduction
Aspect Oriented Programing - IntroductionAspect Oriented Programing - Introduction
Aspect Oriented Programing - Introduction
 
Fursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogoFursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogo
 
Object Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptObject Oriented Programing in JavaScript
Object Oriented Programing in JavaScript
 
Jipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la SitaJipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la Sita
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
Uhusiano fonolojia vs mofolojia
Uhusiano fonolojia vs mofolojiaUhusiano fonolojia vs mofolojia
Uhusiano fonolojia vs mofolojia
 

Ähnlich wie OOP PRINCIPLES EXPLAINED (20)

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
80410172053.pdf
80410172053.pdf80410172053.pdf
80410172053.pdf
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
Oops
OopsOops
Oops
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
 
Cs2305 programming paradigms lecturer notes
Cs2305   programming paradigms lecturer notesCs2305   programming paradigms lecturer notes
Cs2305 programming paradigms lecturer notes
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
OOP intro.ppt
OOP intro.pptOOP intro.ppt
OOP intro.ppt
 
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
 

Kürzlich hochgeladen

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Kürzlich hochgeladen (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

OOP PRINCIPLES EXPLAINED

  • 2. OOP ITRODUCTION • What is object oriented programming? Object-oriented programming (OOP) is a way to organize and conceptualize a program as a set of interacting objects. • The programmer defines the types of objects that will exist. • The programmer creates object instances as they are needed.
  • 3. OOP CONT…………. • The programmer specifies how these various object will communicate and interact with each other. • Object-oriented programming is a methodology that gives programmers tools to make this modeling process easier. • Simply we can say Object-oriented programming, or OOP, is an approach to problem solving where all computations are carried out using objects.
  • 4. TEMINOLOGIES USED IN OOP • Object • Class • Instance • Inheritance • Encapsulation • Abstraction • Polymorphism • Overloading
  • 5. Object • An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program. • An object contains both data and methods that manipulate that data – An object is active, not passive; (it does things) – An object is responsible for its own data
  • 6. Object • Code in object-oriented programming is organized around objects. Once you have your objects, they can interact with each other to make something happen • Let's say you want to have a program where a person gets into a car and drives it from A to B. You would start by describing the objects, such as a person and car. That includes methods: a person knows how to drive a car and a car knows what it is like to be driven. Once you have your objects, you bring them together so the person can get into the car and drive.
  • 7. Class • A class is a blueprint or template or set of instructions to build a specific type of object. or • class is the generic definition for a set of similar objects • A class can be thought of as a template used to create a set of objects. • A class is a static definition; a piece of code written in a programming language
  • 8. Class • So, let's say you want to use a person in your program. You want to be able to describe the person and have the person do something. A class called 'person' would provide a blueprint for what a person looks like and what a person can do. To actually use a person in your program you need to create an object. You use the person class to create an object of the type 'person.' Now you can describe this person and have it do something.
  • 9. Class A class is a statement class ClassVariable attr AttrName1 : AttrNameN meth Pattern1 Statement end : meth PatternN Statement end end
  • 10. Instance • An instance is a realization of a particular item of a class. In other words, an instance is an instantiation of a class. All the instances of a class have similar properties, as described in the class definition. For example, you can define a class called "Student" and create three instances of the class "Student" for "Peter", "Paul" and "Pauline". • The term "object" usually refers to instance. But it is often used loosely, and may refer to a class or an instance. • instance is a concrete occurrence of any object, existing usually during the runtime of a computer program
  • 11. Example of instance For examples, suppose that we have a class called Circle, we can create instances of Circle as follows: // Declare 3 instances of the class Circle, c1, c2, and c3 Circle c1, c2, c3; // They hold a special value called null // Construct the instances via new operator c1 = new Circle(); c2 = new Circle(2.0); c3 = new Circle(3.0, "red"); // You can Declare and Construct in the same statement Circle c4 = new Circle();
  • 12. Inheritance • Inheritance • Inheritance is the process of forming a new class from an existing class that is from the existing class called as base class, new class is formed called as derived class. • This is a very important concept of object- oriented programming since this feature helps to reduce the code size.
  • 13. Example // A class to display the attributes of the vehicle class Vehicle { String color; int speed; int size; void attributes() { System.out.println("Color : " + color); System.out.println("Speed : " + speed); System.out.println("Size : " + size); } } // A subclass which extends for vehicle class Car extends Vehicle { int CC; int gears; void attributescar() {
  • 14. Example cont…… // The subclass refers to the members of the superclass System.out.println("Color of Car : " + color); System.out.println("Speed of Car : " + speed); System.out.println("Size of Car : " + size); System.out.println("CC of Car : " + CC); System.out.println("No of gears of Car : " + gears); } } public class Test { public static void main(String args[]) { Car b1 = new Car(); b1.color = "Blue"; b1.speed = 200 ; b1.size = 22; b1.CC = 1000; b1.gears = 5; b1.attributescar(); } }
  • 15. Encapsulation • Encapsulation is placing the data and the functions that work on that data in the same place. While working with procedural languages, it is not always clear which functions work on which variables but object- oriented programming provides you framework to place the data and the relevant functions together in the same object.
  • 16. Benefits of Encapsulation • Makes it easy to model real-world entities – hence easy to understand and maintain • Control the way data is accessed or modified • Makes the class easy to use for clients • Increase reusability • Aids to the flexibility of design e.g. It is possible to add accelerationConfiguration field in the Car. This will enable you to have different acceleration behaviour of each car.
  • 17. Abstraction • Polymorphism is the capability of a method to do different things based on the object that it is acting upon. In other words, polymorphism allows you define one interface and have multiple implementations
  • 18. Overloading • Overloading is ability of one function to perform different tasks, i.e,it allows creating several methods with the same name which differ from each other in the type of the input and the output of the function.
  • 19. Private and public • Public, means all the class members declared under public will be available to everyone. The data members and member functions declared public can be accessed by other classes too. Hence there are chances that they might change them. So the key members must not be declared public. example class PublicAccess { public: // public access specifier int x; // Data Member Declaration void display(); // Member Function decaration }
  • 20. Private • Private , means that no one can access the class members declared private outside that class. If someone tries to access the private member, they will get a compile time error. By default class variables and member functions are private.
  • 21.
  • 22. Methods and properties of the class • A method in object-oriented programming (OOP) is a procedure associated with a message and an object. An object is made up of data and behavior, which form the interface that an object presents to the outside world. Data is represented as properties of the object and behavior as methods. For example, a Window object would have methods such as open and close, while its state (whether it is opened or closed) would be a property.
  • 23. Class methods • Class methods are methods that are called on a class rather than an instance. They are typically used as part of an object meta- model. I.e, for each class defined an instance of the class object in the meta-model is created.
  • 24. property • property is a member of a class that plays an intermediary role to a field of the class. For example, if you have a field of class and that member represents the salary of an employee, a property can be the "door" that other classes that need the salary must present their requests to. As such, these external classes cannot just change the salary or retrieve it as they wish. A property can be used to validate their request, to reject or to accept them. • A property is used to "filter" access to a field of a class. Therefore, you start by declaring a (private (if you don't make it private, you may be deceiving the purpose of creating a property)) field
  • 25. property • A property is used to "filter" access to a field of a class. Therefore, you start by declaring a (private (if you don't make it private, you may be deceiving the purpose of creating a property)) field

Hinweis der Redaktion

  1. Th
  2. Class Car  A has all the features of a vehicle. But it has its own attributes which makes it different from other subclasses.