Back to category: Science

Limited version - please login or register to view the entire paper.

Object Oriented Program

For a language to be classified as object-oriented it must also provide inheritance and polymorphism. Inheritance is the capability to derive one class from another. A derived class is a completely new data type that incorporates all of the data member and member functions of the original class with any new data and functions members unique to itself. The class used as the basis for the derived type is referred to as the base or parent class and the derived data type is referred to as the derived or child class.

A derived class has the same form as any other class in that it consists of both a declaration and an implementation. The only difference is in the first line of the declaration section. For a derived class this line is extended to include an access specification and a base class name has the form:
class derived-class-name : class-access base-class-name

To illustrate the concept of inheritance we will derive a Box class from a base class Rectangle. The following progr...

Posted by: Gabrielle Gooch

Limited version - please login or register to view the entire paper.