Qus:    Explain the difference between a class and an object?
Nov 06, 2020 04:51 2 Answers Views: 102 NAIDU

1) Object is an instance of a class whereas Class is a blueprint or template from which objects are created.

2) Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. whereas Class is a group of similar objects.

3) Object is a physical entity whereas Class is a logical entity.

4) Object is created through new keyword mainly e.g. Student s1=new Student(); whereas Class is declared using class keyword e.g. class Student{}

5) Object is created many times as per requirement whereas Class is declared once.

6) Object allocates memory when it is created whereas Class doesn't allocated memory when it is created.

Prev Next
Answers (2)
SAI Nov 07, 2020 01:23
Answer:   CLASS:
Class is the definition of an object
It is a template of the object
It describes all the methods, properties, etc
OBJECT:
An object is an instance of a class.
A class does not become an object unless instantiated
An object is used to access all those properties from the class.

PARTH Nov 11, 2020 08:55
Answer:   1) Object is an instance of a class whereas Class is a blueprint or template from which objects are created.
2) Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. whereas Class is a group of similar objects.
3) Object is a physical entity whereas Class is a logical entity.
4) Object is created through new keyword mainly e.g. Student s1=new Student(); whereas Class is declared using class keyword e.g. class Student{}
5) Object is created many times as per requirement whereas Class is declared once.
6) Object allocates memory when it is created whereas Class doesn't allocated memory when it is created.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect