Snapshots on OOP

Snapshots on OOP

OOP languages have three traits in common: encapsulation,
polymorphism, and inheritance.

holds true for C++, Java and C#.

binds together code and the data it manipulates. Encapsulation
creates a black box that has well-defined interfaces. The internal
details are unknown and can be changed. Implementation of the
contracts defined by the interfaces or methods or functions or
subroutines (I use all 4 terms; you may be familiar with one or two
or all four) is left to the creator. The black box is an object that
is defined by a class. The function or method definition is the
lowest level of programming/design by contract; the behavior of the
implementations is expected to be consistent across different

comes from the Greek meaning having multiple forms. With
polymorphism, a single set of interfaces is provided to the user of
the object/class. Thus a generic interface is presented for a class
of objects. The data and implementation may differ but the interface
invoked is the same for all objects of that type or class. The
programmer i.e. the user only remembers the interface. These
interfaces could be Java or C# interface methods , Java, C# or C++
functions or methods which can be overridden in derived classes.
Polymorphism is implemented by the 3

property of OOP languages, inheritance.

inheritance, objects can acquire the properties of other objects.
Inheritance is usually used for hierarchical classification i.e. type
of classifications. General attributes or behavior is abstracted out
to the parent class; object-specific behavior and data is localized
to the specific class.


Blogged with the Flock Browser