Difference Between Class and Object in C++
Hello friends Gaurav Rawat is here with new concept. Today we can see Difference Between Class and Object in C++. It is generally asked in any interview at fresher level.
Some Important difference between class and object
- Object is an instance of a class. Class is a blueprint or template from which objects are created.
- Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. Class is a group of similar objects.
- Object is created many times as per requirement. Class is declared once.
- Object allocates memory when it is created. Class doesn't allocated memory when it is created.
- Object is a physical entity. Class is a logical entity.
Object is created through new keyword mainly e.g.
Student s1=new Student();
Class is declared using class keyword e.g.
class Student{}
No comments :
Post a Comment