forum 1

forum 1

by saifuddin islam -
Number of replies: 0


Difference between class and objects are as follows:

1. Class is a template of objects. But object is an instance of class.

2. While creating a class, no memory allocation is needed. But for object, memory allocation is required. 

3. Class has to be declared first and once. But objects are created many times as you wish.

4. Class can't be manipulated. But objects can.

5. Class is a logical entity. But objects are physical entity.

6. Class is declared with a class keyword. But objects are created with the "new" keyword. 

7. Class is used to bind data and method together in a single unit. But objects are like variable of the class. 


As example we can say, Bike is a class. It's objects are Ducati, Suzuki, Kawasaki.