Just now i’m reading The Four Principles of Object Oriented Programming

We have our semester sessional programming exam in one hour



Four principles of object oriented programming:

  • Data Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

Data abstraction

Any representation of data in which the implementation details are
hidden (abstracted). Abstract data types
and objects are the two primary forms of data


The ability to provide users with a well-defined interface to a set of functions
in a way which hides their internal workings. In object-oriented
programming, the technique of keeping together data structures and the
methods (procedures) which act on them.


The ability to derive new classes from existing
classes. A derived class (or
“subclass”) inherits the instance
variables and methods of the base
class and may add new instance variables
and methods. New methods may be defined with the same names as those in the base
class, in which case they override the original one.

For example, bytes might belong to the class of integers for which an add method
might be defined. The byte class would inherit the add method from the integer


Polymorphism refers to the ability to define multiple classes with
functionally different, yet identically named methods or properties that can be
used interchangeably by client code at run time.

Is a function which operates on a list of objects of any type. This is known
as parametric polymorphism. Polymorphic typing allows strong type checking as
well as generic functions.

Ad-hoc polymorphism (better described as overloading)
is the ability to use the same syntax for objects of different types, e.g.
“+” for addition of reals and integers or “-” for unary
negation or diadic subtraction. Parametric polymorphism allows the same object
code for a function to handle arguments of many types but overloading only
reuses syntax and requires different code to handle different types.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s