base class?

hi
im a total newbie
whats a base class?
is it just the default?
and do you have a base class ie mybase
and then another class with the same name?
what is the point of them?
thanks
paul
paulwhelanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

paulwhelanAuthor Commented:
also is this something to do with a constructor?
jonorossiCommented:
A base class is another class you wish to inherit from while a child or sub class is the class inheriting. An example of inheritance is:

Vehicle (the base class)
|- Car
|  |- Sedan
|  |- Wagon
|- Truck
|- Bicycle

Examples: a car is a vehcile, a sedan is a car and is also a vehicle, a truck is a vehicle but is not a car, and a bicycle is a vehicle but not a sedan.

Having classes like this allows you to have properties for all vehicles, for example: owner, exterier colour. And all cars can have properties like number of cylinders while bicycles do have cylinders.

A constructor is basically a method that is called when you create an object. For example I was to create a new Sedan, i would use the code like this:
Sedan myCar = new Sedan("ABC123", Color.Red)

The 2 parameters in brackets are passed to the constructor which could look something like this:

class Sedan : Car
{
    public Sedan(string regoNumber, Color outsideColor)
    {
        // so something with the rego and color
    }
}

You might want to ready some more about the 3 major principles of Object Oriented Programming which are: Inheritance, Polymorphism and Encapsulation. These will help you to understand what this stuff is for. Also read about what a class is because some people explain how to work out your classes for your application very well with simple steps to follow; I remember seeing one somewhere that also guided you to work out what methods and properties you will need.

Hope that helps, Jono

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.