Inheritance
--inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. Inheritance is employed to help reuse existing code with little or no modification
Super Class
-- superclass allows for a generic interface to include specialized functionality through the use of virtual functions
--a superclass, base class, or parent class is a class from which other classes are derived. The classes that are derived from a superclass are known as child classes, derived classes, or subclasses.
--The superclass mechanism is extensively used in object oriented programming due to the reusability that can be achieved: common features are encapsulated in modular objects. Subclasses that wish to implement special behavior can do so via virtual methods, without having to duplicate (reimplement) the superclass's behavior.
Subclass
--subclass is a class that inherits some properties from its superclass.
Benefits of inheritance
--1. Code reusebility.
2. Minimise the amount of duplicate code.
3. Sharing common code amongst several subclasses.
4. Smaller, simpler and better organisation of code.
5. Make application code more flexible to change.
Overriding Methods
--The ability of a subclass to override a method in its superclass allows a class to inherit from a superclass whose behavior is "close enough" and then override methods as needed.
Polymorphism
--The ability of a reference variable to change behavior according to what object it is holding.–This allows multiple objects of different subclasses to be treated as objects of a single superclass, while automatically selecting the proper methods to apply to a particular object based on the subclass it belongs to.
Abstract Classes
--a class that cannot be instantiated. –often appears at the top of an object-oriented programming class hierarchy, defining the broad types of actions possible with objects of all subclasses of the class
Interface
--is a special kind of block containing method signatures (and possibly constants) only. –defines the signatures of a set of methods, without the body. –defines a standard and public way of specifying the behavior of classes. –allows classes, regardless of their locations in the class hierarchy, to implement common behaviors. –NOTE: interfaces exhibit polymorphism as well, since program may call an interface method, and the proper version of that method will be executed depending on the type of object passed to the interface method call.
Thursday, April 22, 2010
Inheritance,Polymorphism,Interface
Posted by michael_javier at 1:53 AM
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment