Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

C%20%20%20Interview%20Questions%20and%20Answers

Question: What is the difference between an object and a class?
Answer:
Classes and objects are separate but related concepts. Every object belongs to a class and every class contains one or more related objects.
- A Class is static. All of the attributes of a class are fixed before, during, and after the execution of a program. The attributes of a class don't change.
- The class to which an object belongs is also (usually) static. If a particular object belongs to a certain class at the time that it is created then it almost certainly will still belong to that class right up until the time that it is destroyed.
- An Object on the other hand has a limited lifespan. Objects are created and eventually destroyed. Also during that lifetime, the attributes of the object may undergo significant change.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook