OOP Concepts

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

OBJECT ORIENTED PROGRAMMING CONCEPTS

By, Mona salma

Object: An Object has state, behavior and events. It is the collection of data. It can be anything
seen or anything that can be thought of. An object is made of certain functionality, methods and
events. An object is an entity that has properties for identifying its states and for validations,
methods for behavior/functionality and change of state is depicted to events. Also known as
attributes and properties.
The state of an object is the data which is associated at any given instance of time. The data
identifies state of an object and the functionality identifies behavior of an object. For instance, a
pen, while you write with it the change in state takes place as the ink decreases. The event of an
object is when an action is performed. Change in state of an object is depicted to the other
objects in the form of an event. For instance, take a form, click on the button on a form, change
in state of the button happens, that button is then communicated to the form, button rises an
event to form.
Person person = new Person ();
Class: A class is an instance or a blueprint of an object. It is a collection of methods/ functions
with properties of an object. It allows us to create as many objects as we want.
Constructors are called anytime by a special type of method when a new object is created.
For instance, class consists of a person’s information such as F.name, L.name, DOB, address,
gender etc which is the data provided. It also consists of functions which has behavior, logic,
methods of a person.
class Person{
}
Object oriented application: It is a collection of many objects but should be related objects
who can communicate with each other and exchange messages with each other in a controlled
environment as per the rules of the business.
Component: It is a replaceable object. An object is something constructed from the class which
have been created whereas, component is something which somebody else has created and have
been purchased. It is readymade without getting to know the internal details.
An object by not exposing itself completely to the world it helps the world. Objects should
always be loosely coupled.
Object oriented language has three main features:-
Encapsulation:
It means hiding complexity. The process of binding data and behavior i.e. functionality of an
object within a secured and controlled environment is encapsulation. Data encapsulated by some
functionality so that the restricted access to that data is provided. Data encapsulation is the most
striking feature of the class.
Its principle is used to implement the information hiding i.e. data abstraction. Data abstraction
is the result of the feature encapsulation. It is about hiding certain data from other objects in the
application and exposing only what is needed. Data can only be accessed via methods.

Inheritance: Acquiring the existing functionality of the parent and with added features and
functionality by the child is inheritance. Inheritance leads to generalization, extensibility and
reusability. Every object-oriented programming language supports inheritance otherwise it is
called object-based programming. ‘Is-a’ depicts inheritance in which both are classes.
Composition: Composition over inheritance means implementing has-a relationships using
composition instead of inheritance.
Delegation is another feature that can be used in place of inheritance.
Polymorphism: It means an object in different forms it exhibits the same functionality but
implemented in different ways.
Dynamic binding: It refers to the linking of a procedure call to the code to be executed in
response to the call.
Message Passing: An object oriented program consists of a set of objects that communicate with
each other. Creating classes that define object and their behavior. Creating objects from class
definitions and establishing communication among objects.
Interface: Methods form the object’s interface with the outside world. It is a group of related
methods with empty bodies.
Packages: They are namespaces which organizes a set of related classes and interfaces just like a
folder on a computer.

References:
https://en.wikipedia.org/wiki/Object-
oriented_programming#Composition.2C_inheritance.2C_and_delegation
https://www.clear.rice.edu/mech517/Books/oop3.pdf
file:///C:/Users/User/Downloads/9781441909671-c1.pdf
http://web.cse.ohio-state.edu/software/2221/web-sw1/extras/slides/22.OOP-Concepts.pdf
http://www.ddegjust.ac.in/studymaterial/mca-3/ms-17.pdf

You might also like