Saturday, November 9, 2013

What is Class?

A class is the blue print from where individual objects are created.  For example in real world, we may find many individual objects of same kind. There may be thousands of bikes in existence, all of the same make and model. Each bike was built from the same set of blueprints and therefore contains the same component. In object oriented terms, we say that our bike is an instance of the class of objects known as bikes.

The following Bike class is one of implementation of a bike.

class Bike {
        int Speed = 0;
        int Gear = 0;
        void SpeedUp(int increment)
        {
            Speed += increment;
        }
        void ApplyBreakes(int decrement)
        {
            Speed -= decrement;
        }
    }

Simple example of class is

class SampleClass {
   

    }

1 comment:

  1. Hi,An experienced Web Design Cochin company will have a solid portfolio of web sites that they have created for other clients.Thanks...

    ReplyDelete