[Solved]Aren’t objects just copies of classes?

10/12/2019 2:46:00 AM


7 Answers

New Answer


Objects are instances of class. You can think class as a blueprint and objects as final products made out of that blueprint


Utsav Prasad is your post relevant here?


You can use a copy constructor to make copies of objects, not copies of classes.


Objects are not copies of classes, but objects can inherit some attributes from their classes.


You can probably make a copy of a class by simply extending it but not specialising it further. I.e. not adding any more fields or methods.


Another difference between classes and objects... the actual code exists only once and is associated with the class. To further the blueprint analogy, the blueprint has the instructions and the object doesn’t need a copy of the instructions.