A Class in Object Oriented Programming - OOP
The class is a model or blueprint or prototype of an object that defines or specifies all the properties of the objects. Classes have the data and its associated function wrapped in it. The class defines the state and behaviours of an object. Before creating an object we know what properties or data members an object will contains based on the class. The classes contain the data members and member functions. The class is a logical entity and not a physical because class represents a category of the objects. For instance, fruit is a class that is not physical but represents a category for objects like an Apple, Banana, Mango, Pineapple, etc. with common properties like color, taste, price, etc.
There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle has built from the same blueprint. In object-oriented terms, we say that the bicycle is an instance of the class of objects known as bicycles.
Examples of a Class:
In C++ Language-class Car { public: //public is a access modifier int carId; // Car id string model; // Car model name private: //private is a access modifier double price; // price of the car };//end of class with semicolonIn Java Language-
class Car { public int carId; // Car id String model; // Car model name private double price; // price of the car }//end of class without semicolon