SlideShare a Scribd company logo
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.
object oriented programing lecture 1
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

More Related Content

What's hot (20)

Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
HalaiHansaika
 
WHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVAWHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVA
sivasundari6
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
class and objects
class and objectsclass and objects
class and objects
Payel Guria
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
Dhrumil Panchal
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Poojith Chowdhary
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
Jsaddam Hussain
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
Sequences and indexes
Sequences and indexesSequences and indexes
Sequences and indexes
Balqees Al.Mubarak
 
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
Madishetty Prathibha
 
Constructors in C++
Constructors in C++Constructors in C++
Constructors in C++
RubaNagarajan
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
ThamizhselviKrishnam
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
Vineeta Garg
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
[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 objects in java
Classes objects in javaClasses objects in java
Classes objects in java
Madishetty Prathibha
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
BG Java EE Course
 
Data structure
Data structureData structure
Data structure
Muhammad Farhan
 
Friend function in c++
Friend function in c++ Friend function in c++
Friend function in c++
University of Madras
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
HalaiHansaika
 
WHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVAWHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVA
sivasundari6
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
class and objects
class and objectsclass and objects
class and objects
Payel Guria
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
Dhrumil Panchal
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
Jsaddam Hussain
 
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
Madishetty Prathibha
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
[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
 

Viewers also liked (20)

Object Oriented Programing - Intro
Object Oriented Programing - IntroObject Oriented Programing - Intro
Object Oriented Programing - Intro
Bayu Firmawan Paoh
 
Mofolojia ya kiswahili
Mofolojia ya kiswahiliMofolojia ya kiswahili
Mofolojia ya kiswahili
Geophery sanga
 
Project object explain your choice
Project object   explain your choiceProject object   explain your choice
Project object explain your choice
Soren
 
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 kibiblia
001111111111
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
246paa
 
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOP
Mudasir Qazi
 
OOPS features using Objective C
OOPS features using Objective COOPS features using Objective C
OOPS features using Objective C
Tiyasi Acharya
 
Dynamics Telephony Dialer Intro
Dynamics Telephony Dialer IntroDynamics Telephony Dialer Intro
Dynamics Telephony Dialer Intro
Eddie Steede
 
Object Oriented Programing - Inheritance
Object Oriented Programing - InheritanceObject Oriented Programing - Inheritance
Object Oriented Programing - Inheritance
Bayu Firmawan Paoh
 
Object Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismObject Oriented Programing - Polymrphism
Object Oriented Programing - Polymrphism
Bayu Firmawan Paoh
 
Water resources management river basin manage
Water resources management river basin manageWater resources management river basin manage
Water resources management river basin manage
Mwl. Mapesa Nestory
 
Futuristic programing language
Futuristic programing languageFuturistic programing language
Futuristic programing language
Mohamed Zaki
 
Aspect Oriented Programing - Introduction
Aspect Oriented Programing - IntroductionAspect Oriented Programing - Introduction
Aspect Oriented Programing - Introduction
Venkaiah Chowdary Koneru
 
Fursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogoFursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogo
YSDO and MAP
 
Object Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptObject Oriented Programing in JavaScript
Object Oriented Programing in JavaScript
Akshay Mathur
 
Jipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la SitaJipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la Sita
kanguni
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
baabtra.com - No. 1 supplier of quality freshers
 
Object Oriented Programing - Intro
Object Oriented Programing - IntroObject Oriented Programing - Intro
Object Oriented Programing - Intro
Bayu Firmawan Paoh
 
Mofolojia ya kiswahili
Mofolojia ya kiswahiliMofolojia ya kiswahili
Mofolojia ya kiswahili
Geophery sanga
 
Project object explain your choice
Project object   explain your choiceProject object   explain your choice
Project object explain your choice
Soren
 
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 kibiblia
001111111111
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
246paa
 
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOP
Mudasir Qazi
 
OOPS features using Objective C
OOPS features using Objective COOPS features using Objective C
OOPS features using Objective C
Tiyasi Acharya
 
Dynamics Telephony Dialer Intro
Dynamics Telephony Dialer IntroDynamics Telephony Dialer Intro
Dynamics Telephony Dialer Intro
Eddie Steede
 
Object Oriented Programing - Inheritance
Object Oriented Programing - InheritanceObject Oriented Programing - Inheritance
Object Oriented Programing - Inheritance
Bayu Firmawan Paoh
 
Object Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismObject Oriented Programing - Polymrphism
Object Oriented Programing - Polymrphism
Bayu Firmawan Paoh
 
Water resources management river basin manage
Water resources management river basin manageWater resources management river basin manage
Water resources management river basin manage
Mwl. Mapesa Nestory
 
Futuristic programing language
Futuristic programing languageFuturistic programing language
Futuristic programing language
Mohamed Zaki
 
Fursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogoFursa kwa walio na mtaji mdogo
Fursa kwa walio na mtaji mdogo
YSDO and MAP
 
Object Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptObject Oriented Programing in JavaScript
Object Oriented Programing in JavaScript
Akshay Mathur
 
Jipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la SitaJipime Sayansi Darasa la Sita
Jipime Sayansi Darasa la Sita
kanguni
 
Ad

Similar to object oriented programing lecture 1 (20)

Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
Abhigyan Singh Yadav
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
4-OOPS.pptx
4-OOPS.pptx4-OOPS.pptx
4-OOPS.pptx
SatyamMishra237306
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Amit Soni (CTFL)
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
AnmolVerma363503
 
Oops
OopsOops
Oops
Sankar Balasubramanian
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTORUNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
ACCESS Health Digital
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
RaazIndia
 
PPT_Object Oriented Programming .pptx
PPT_Object Oriented Programming     .pptxPPT_Object Oriented Programming     .pptx
PPT_Object Oriented Programming .pptx
MDFARHAN3070
 
PPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptxPPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptx
faizus786
 
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTSOOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
RajendraKumarRajouri1
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
Introduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.pptIntroduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.ppt
IKATrainingCentre
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
Abhigyan Singh Yadav
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Amit Soni (CTFL)
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTORUNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
RaazIndia
 
PPT_Object Oriented Programming .pptx
PPT_Object Oriented Programming     .pptxPPT_Object Oriented Programming     .pptx
PPT_Object Oriented Programming .pptx
MDFARHAN3070
 
PPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptxPPT_Object Oriented Programming (2).pptx
PPT_Object Oriented Programming (2).pptx
faizus786
 
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTSOOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
RajendraKumarRajouri1
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
Introduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.pptIntroduction to Object Oriented Programming.2.ppt
Introduction to Object Oriented Programming.2.ppt
IKATrainingCentre
 
Ad

Recently uploaded (20)

EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time OffHow to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
Freckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptxFreckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptx
EveryLibrary
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglesela storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Coleoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptxColeoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptx
Arshad Shaikh
 
Pharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptxPharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptx
Shantanu Ranjan
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time OffHow to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
Freckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptxFreckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptx
EveryLibrary
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglesela storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Coleoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptxColeoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptx
Arshad Shaikh
 
Pharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptxPharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptx
Shantanu Ranjan
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 

object oriented programing lecture 1

  • 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.
  • 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

Editor's Notes

  • #12: Th
  • #14: Class Car  A has all the features of a vehicle. But it has its own attributes which makes it different from other subclasses.