What is the relationship between a class, object, and instance?
Although this seems like a simple question, I have had many ‘interesting’ discussions and am not exactly sure where one starts and another ends. Here is one possible definition:
A class is created to hold an integer.
This is a class and an object(?), or just a class?
Property Age as Integer
in code, the instance of an object is created (?), or is this an instance of a class to create an object?
Dim Bob as New Person
I have heard two common definitions, and which one is right - or is this in subjective to someones view?
Possible Definition 1) A class is created in IDE code. When the program runs then the class is considered an object. When a new variable of the object is created, then this is considered an instance of the object. When the class for Bob’s age is changed, then it is the instance of the object data that is changed.
Possible Definition 2) A class is created in IDE code. When the program runs then the class is still considered a class. When a new variable of the object is created, then the instance of the class is created to make an object. When the class for Bob’s age is changed, then it is the object of the class that has changed.
Which one is right, or are both incorrect?