Your host:
Stephen Chapman
Stephen Chapman

OOP Heirarchy

Question: What would be examples of object-oriented inheritance hierarch.
Anonymous

Answer: A real world example of object oriented inheritance:
If we start with VEHICLE as a base class meaning anything that can transport people or things. We can now define ROAD_VEHICLE that inherits from VEHICLE (because all road vehicles are vehicles) which adds the functionality common to all road vehicles. If we next define CAR it can inherit from ROAD_VEHICLE and add of of the things that cars have in common.

A Javascript example of object oriented inheritance is that all Javascript classes (apart from the object class) inherit from the object class which provides all of that functionality that is common to all Javascript objects.

go to top

Add to del.icio.us

Loans - Flights - Renegade Motorhomes - Loans