Professional Documents
Culture Documents
Object oriented
Definition
Object-orientated programming (OOP) is
a programming paradigm that uses
objects and their interactions to design
applications and computer programs.
Characteristics
Encapsulation
This is the mechanism that binds data
structures and the methods (procedures)
which act on them, thus keeping them
together. It is based on the principle of
information hiding, which is the hiding of
design decisions in a computer program
that are most likely to change, thus
protecting other parts of the program from
change if the design decision is changed.
Characteristics
Encapsulation
Moreover it refers to the ability to provide
users with a well defined interface to a set of
functions in a way which hides their internal
workings.
Eg:
shape
myshape;
Here myshape is declared as a variable of the
class shape.
Characteristics
Inheritance
This is a way of forming new classes
using classes that have already been
defined. The new classes, known as
derived classes, inherit or derive their
attributes from the pre-existing classes,
which are referred to as base classes or
ancestor classes. It is intended to help
reuse the existing code with little or no
modification.
Inheritance
In the following example, class person is
a base class and classes MathsTeacher
and Footballer are derived from Person.
Characteristics
Polymorphism
Poly means many. Morphism means
forms.
Polymorphism refers to a programming
languages ability to process objects
depending on their data type or class. In
other words the feature enables classes
to provide different implementation of
methods having the same name.
Characteristics
Polymorphism
For example, given a base class shape,
polymorphism enables the programmer
to define different area methods for any
number of derived classes such as cirlces
rectangles and triangles.
No matter what shape an object is,
applying the area method to it will return
the correct results.
Characteristics
Modularity
Modularity refers to the concept of
increasing the extent to which software is
composed from separate parts, called
modules. Multiple modules are made
first then they are linked and combined
to form a complete sytem. Modularity
enables re-usability and minimizes
duplication.
Disadvantages of Object
Code Programming
Disadvantages of Object
Code Programming
Disadvantages of Object
Code Programming
Sample of Code