0% found this document useful (0 votes)
27 views4 pages

OOP Paradigm With Example

Uploaded by

anee.cse8.bu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

OOP Paradigm With Example

Uploaded by

anee.cse8.bu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

OOP paradigm with example

Object-Oriented Programming
Object oriented programming is a methodology or paradigm to design a program
using classes and objects. It simplifies the software development and
maintenance by providing some concepts defined below:

1. Class: Class is a user-defined data type which defines its properties and its
functions. Class is the only logical representation of the data. For example,
Human being is a class. The body parts of a human being are its properties,
and the class actions performed by the body parts are known as functions.
The class does not occupy any memory space till the time an object is
instantiated.

2. Object: Object is a run-time entity. It is an instance of the class. An object


can represent a person, place or any other item. An object can operate both
data members and member functions.
public static void main(String[] args) {
Student objOne = new Student();
objOne.name = “Tahira”;
}

3. Attribute: An attribute is a specification that defines the property of an


object. It may also refer to set the specific value for a given instance of such.
These are typically represented as variables within a class and can represent
properties of the objects that will be created from the class.
4. Method: In Object-oriented Programming (OOP), a method is a block of
code or function that is associated with an object and is allowed to access
and modify the data inside tat object. Methods define the behavior of an
object. They are declared inside a class and are used to perform specific
tasks.

5. Encapsulation: Encapsulation is the process of combining data and


functions into a single unit called class. In Encapsulation, the data is not
accessed directly; it is accessed through the functions present inside the
class. In simpler words, attributes of the class are kept private and public
getter and setter methods are provided to manipulate these attributes.
Thus, encapsulation makes the concept of data hiding possible.

6. Inheritance: Inheritance is a process in which one object acquires all the


properties and behaviors of its parent object automatically. In such a way,
you can reuse, extend or modify the attributes and behaviors which are
defined in other classes.
In java, the class which inherits the members of another class is called
derived class and the class whose members are inherited is called base
class. The derived class is the specialized class for the base class.

7. Abstraction: Abstraction is mainly used to hide the complexity of large


systems by splitting them into smaller, more manageable modules or
classes. Each module has a specific task. Each module is built separately and
then they are combined to form a large system.
In simple terms, it is hiding the unnecessary details & showing only the
essential parts/functionalities to the user.
8. Polymorphism: Polymorphism is the ability to present the same interface
for differing underlying forms (data types). With polymorphism, each of
these classed wills have different underlying data. Precisely, Poly means
“many” and morphism means “forms”.

You might also like