Thread: Program of inheritance

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    96

    Program of inheritance

    Hi Guys,

    I am making a program on inheritance, I have made a small program of automobile and want to make sure that 2 cars(base class) inherit the characteristics of the parent class(Vehicle).

    This is the extract from the program:

    Code:
    class Vehicle
    
    {
    
    private:
    
    int modelno;
    char name;
    
    
    public :
    
    int getmodel(); 
    int setmodel();
    
    
    };
    
    class Car:public Vehicle 
    
    {
    
    
    };
    ----------------------------------------------------------------------

    I wanted to know that do I have to define the functions "int getmodel()" and "int setmodel()" in the base class "Car" or it will inherit these functions from the parent class "Vehicle"?

    Will this class Car inherit the data members from the parent class "Vehicle" itself?

    Thanks
    Last edited by student111; 06-06-2012 at 04:25 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inheritance
    By Aisthesis in forum C++ Programming
    Replies: 8
    Last Post: 09-27-2009, 03:35 AM
  2. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  3. Inheritance and program structure planning please help a newbie
    By ninjacookies in forum C++ Programming
    Replies: 1
    Last Post: 10-23-2005, 12:18 PM
  4. Inheritance and Dynamic Memory Program Problem
    By goron350 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2005, 02:38 PM
  5. Inheritance?
    By Krak in forum C++ Programming
    Replies: 3
    Last Post: 07-16-2003, 08:32 PM