0% found this document useful (0 votes)
2 views

Features of Oops

The document provides an overview of key concepts in Object-Oriented Programming (OOP) including classes, objects, message passing, inheritance, polymorphism, containership, data abstraction, genericity, reusability, delegation, and encapsulation. Each concept is defined with examples and explanations of how they function and their benefits in programming. It emphasizes the importance of these principles in creating efficient, maintainable, and secure code.

Uploaded by

jaiambashankar06
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Features of Oops

The document provides an overview of key concepts in Object-Oriented Programming (OOP) including classes, objects, message passing, inheritance, polymorphism, containership, data abstraction, genericity, reusability, delegation, and encapsulation. Each concept is defined with examples and explanations of how they function and their benefits in programming. It emphasizes the importance of these principles in creating efficient, maintainable, and secure code.

Uploaded by

jaiambashankar06
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

F

O
E S
U R
AT
E P S
F O
O DONE BY
A.JAIDEEP
CSE J
RA2411003020630
CLASS
It is a user-defined data type, which holds its own data
members and member functions, which can be accessed and
used by creating an instance of that class. A class is like a
blueprint for an object. For Example: Consider the Class of
Cars. There may be many cars with different names and
brands but all of them will share some common properties
like all of them will have 4 wheels, Speed Limit, Mileage
range, etc. So here, the Car is the class, and wheels, speed
limits, and mileage are their properties.
OBJECT
An Object is an identifiable entity with some characteristics
and behavior. An Object is an instance of a Class. When a
class is defined, no memory is allocated but when it is
instantiated (i.e. an object is created) memory is allocated.
Objects take up space in memory and have an associated
address like a record in pascal or structure or union. When a
program is executed the objects interact by sending
messages to one another. Each object contains data and
code to manipulate the data. Objects can interact without
having to know details of each other’s data or code, it is
sufficient to know the type of message accepted and the
type of response returned by the objects.
MESSAGE PASSING
Objects communicate with one another by sending and
receiving information. A message for an object is a request
for the execution of a procedure and therefore will invoke a
function in the receiving object that generates the desired
results. Message passing involves specifying the name of
the object, the name of the function, and the information to
be sent.
INHERITANCE
The capability of a class to derive properties and
characteristics from another class is called Inheritance.
Inheritance is one of the most important features of Object-
Oriented Programming.
Sub Class: The class that inherits properties from another class
is called Sub class or Derived Class.
Super Class: The class whose properties are inherited by a sub-
class is called Base Class or Superclass.
POLYMORPHISM

The word polymorphism means having many forms.


In simple words, we can define polymorphism as
the ability of a message to be displayed in more
than one form. A person at the same time can have
different characteristics. A man at the same time is
a father, a husband, and an employee. So the same
person possesses different behavior in different
situations. This is called polymorphism. An
operation may exhibit different behaviors in
different instances. The behavior depends upon the
types of data used in the operation. C++ supports
operator overloading and function overloading.
CONTAINERSHIP
We can create an object of one class into another and
that object will be a member of the class. This type
of relationship between classes is known
as containership or has_a relationship as one class
contain the object of another class. And the class
which contains the object and members of another
class in this kind of relationship is called a container
class.The object that is part of another object is
called contained object, whereas object that
contains another object as its part or attribute is
called container object. We can create an object of
one class into another and that object will be a
member of the class. This type of relationship
between classes is known
as containership or has_a relationship as one class
contain the object of another class. And the class
which contains the object and members of another
class in this kind of relationship is called a container
DATA ABSTRACTION

Data abstraction is a programming technique in object-


oriented programming (OOP) that simplifies data by
hiding its complexities. It's a key characteristic of
OOP that's implemented using classes and objects.
How it works
Data abstraction creates a simplified representation of
data by hiding its internal details.
It separates the interface from the implementation, so
users only need to understand the interface and
commands.
Data abstraction allows developers to define complex
data types while providing a simple interface for
interacting with objects.
Benefits
Data abstraction simplifies and streamlines the
GENERICITY
Genericity in object-oriented programming (OOP) is a way to define classes,
methods, and interfaces that can be used with any data type. This allows
programmers to create flexible code that can be used in a variety of
situations.
How it works
When a generic is defined, the data types of the method parameters or class
are not known.
When the generic is called or instantiated, the data types are specified.
Generics can be used to create classes, interfaces, and methods that operate
on types specified by the caller.
Benefits
Genericity can help ensure type safety.
It can eliminate the need for casting.
It can help improve the expressiveness, modularity, and efficiency of
programs.
REUSABILITY
Reusability in object-oriented programming (OOP) is the ability to use the same
code repeatedly without rewriting it. It's a major property of OOP that can save
time and effort.
How does reusability work?
Inheritance: A new class, called a derived class, inherits properties from an existing
class, called a base class. The derived class can then use the base class's
functionality.
Polymorphism: Allows developers to create reusable classes and objects.
Traits: A trait can be used to contain methods that can be included in multiple
classes.
Benefits of reusability
Saves time and effort: Developers don't need to rewrite the same code multiple
times.
Reduces complexity: Centralized code is easier to read and maintain.
Improves code structure: Prevents duplicated code and inconsistency.
Reduces testing effort: Centralized code can manage its own unit testing.
DELEGATION
Delegation in object-oriented programming (OOP) is when one
object, the delegate, evaluates a member of another object,
the delegator. This can be done explicitly or
implicitly. Delegation in object-oriented programming (OOP)
is when one object, the delegate, evaluates a member of
another object, the delegator. This can be done explicitly or
implicitly.
ENCAPSULATION

Encapsulation is a fundamental concept in object-oriented


programming (OOP) that groups data and methods into a single
unit. It's used to hide implementation details of an object and
restrict direct access to its components.
How it works
Bundling: Encapsulation bundles data and methods into a class.
Hiding: Encapsulation hides the implementation details of the
class, making it difficult for users to know how it's stored.
Restricting access: Encapsulation restricts direct access to the
class's components, which helps protect the data's integrity.
Providing a public interface: Encapsulation provides a public
interface for interacting with the class.
Benefits of encapsulation
Security: Encapsulation can help improve security by hiding
sensitive data.
Simplicity: Encapsulation can help simplify data hiding and
reduce system complexity.

You might also like