Nheritance: Inheritance Is Specific To Object-Oriented Programming, Where A New Class Is
Nheritance: Inheritance Is Specific To Object-Oriented Programming, Where A New Class Is
Example 1:
Classes can have 'Children' that is, one class can be created out of another class. The
original or parent class is known as the Super Class (or base class). The child class is
known as the Sub Class (or derived class).
PRGRAM:-
using System;
A Sub Class inherits all the attributes and behaviors of the Super Class, and may
have additional attributes and behaviors.
PRGRAM:-
using System;
Example 3:
The attributes and operations in the diagram below are for vehicle class, which
the SubClass inherits. Extra operation is the land Vehicle works only on Land
and the water vehicle works only in water.