C and C++ Programming Resources

Custom Search

Demonstration of inheritance in C++

Demonstration of inheritance in c++.
This example contains the following files.

  • VEHICLE.H
  • VEHICLE.CPP
  • ALLVEHIC.CPP
  • CAR.H
  • CAR.CPP
  • TRANSPORT.CPP
  • TRUCK.H
  • TRUCK.CPP

Vehicle.h is a basic class for a vehicle. Car, truck and allvehicle will be inherited from this base class. All the common features of a vehicle are kept in the base class i.e weight, # of wheels etc…

Derived classes will have the veicle properties and methods as well as their own properties and methods.

  Demonstration of inheritance (2.8 KiB, 2,586 hits)

Tags: , ,

There are No Comments to this post. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response or TrackBack from your own site.


Leave a Reply

You must be logged in to post a comment.