Oops Concepts
Oops Concepts
Inheritance: Two classes (say Car, and Toyota) have the inheritance
relationship between them when one class, say Toyota, is extending the other
class (Car). In this example, Car will be referred to as a base-class or
a superclass whereas Toyota will be referred to as a derived-
class or subclass. Inheritance allows a derived class to take some of the
attributes and methods of the base class. Moreover, the derived class may
enhance the base class by introducing additional attributes and methods.
Inheritance promotes code reusability and extensibility.
What is a constructor ?
Put simply, constructors can create and initialize objects of their class type. They
cannot be classified as volatile or static nor can the body of a constructor contain
a return statement.