Fundamental Characteristics of OOP

A  class can inherit characteristics from another class .Classes em¬body coherent and cohesive concepts. Classes can be used to create more specialized Classes via inheritance. For example, a bicycle can be specialized to a kind built by a given manufacturer.
Inheritance is the mechanism that allows the programmer to derive new classes from existing classes. The derived classes inherit the methods and data structures of the parent class. One can add new methods or override the inherited methods to make them more specific. The parent methods will not be affected because of these modifications.
For example, different kinds of bicycles like bikes can inherit the common properties from a bicycle class and can override the methods in the parent class to suit local properties. For example, some racing bikes have an extra set of gears with a lower gear ratio.

Polymorphism
Polymorphism is a feature that allows one interface to be used for a general class of actions. The concept of polymorphism is often ex-pressed by the phrase “one interface, multiple methods”. It basi¬cally refers to the ability of giving the same name to methods in different subclasses. The individual methods may implement simi¬lar tasks but can be differentiated by the type of arguments passed to them.
By using polymorphism different methods can be created with the same name but with different parameters.

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment