Inheritance - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Inheritance.
Encyclopedia Article

Inheritance - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Inheritance.
This section contains 260 words
(approx. 1 page at 300 words per page)

In object-oriented programming, inheritance is the ability to derive new classes from existing classes. The existing class from which the subclass is derived is called the base class (sometimes called the superclass); the derived class is called either, simply, the derived class, or it's called the subclass. A subclass inherits from the base class, meaning that it has access to the variables and methods of the base class without having to redefine them. A subclass can also define its own variables and methods.

Any time a new variable or method is declared in the base class, it becomes immediately available to the subclass via inheritance. The same holds true for changes made to the base class. Changes to the base class are immediately available to the subclass via inheritance.

A class can inherit from multiple base classes. This is referred to as multiple inheritance. In multiple inheritance, the new subclass derives all the variables and methods offered by each of the base classes. This can cause conflict if more than one of the base classes has the same variable or method. These inheritance clashes are resolved by the subclass either redefining the conflicting variable or method for itself or by specifying which inheritance is preferred.

Inheritance speeds up the development process. It organizes the structure of programs in a modular fashion and increases reuse. In addition it shortens testing time by providing inherent validity to the subclass. If a method works in the base class and is inherited by a subclass, it will also work in the subclass.

This section contains 260 words
(approx. 1 page at 300 words per page)
Copyrights
Gale
Inheritance from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.