I noticed often confusion when it comes to classes, objects and instances. Those who are not very educated on the object-oriented programming often confuses the true meaning of these terms. I knew, however, that there are two schools of thought regarding the definition of classes and objects. I like the "school" that indicates the class definition as a possible subject, and therefore, as an instance of the object.
It seems trivial, but I've - talking with others - to be in "conflict" (so to speak) and then fall into confusion, when using these terms, starting from the assumption that if anything the "other" just as we intend them .
I see it in this way, a class is a definition! It is precisely defines a class of possible objects. The class is the set of methods and properties (if you want we can also add events - what else ... not only that special methods) that will own the object.
For example, when we write in Actionscript, or any other object-oriented language:
1 2 3 4 | class MyClass { MiaClass function () {} function myMethod () {} } |
We have defined a class and not an object. In the limit we have "defined" a "possible" object. We could even argue, and rightly so, that the object exists at runtime while the Class not (in truth there are dynamic classes that can be defined - and then used to create objects - even at runtime). Exclude static classes, of course, that - eventually - are nothing more than sub-instances (or instances hidden) and then real objects.
But when we have:
1 | MiaClasse = new MiaClasse ( ) ; var MyObject: MyClass = new MyClass (); |
! Here mioOggetto is an instance of MiaClasse() ! . That mioOggetto is a subject - in fact - of type MiaClasse() .
. As a result, their philosophy to objects, objects of type MiaClasse() I can have as many as I want, which can not be - the very definition - of MiaClasse() . For example, if the report is true and it makes sense:
1 2 3 4 5 | MiaClasse = new MiaClasse ( ) ; var mioOggetto_1: MyClass = new MyClass (); MiaClasse = new MiaClasse ( ) ; var mioOggetto_2: MyClass = new MyClass (); MiaClasse = new MiaClasse ( ) ; var mioOggetto_3: MyClass = new MyClass (); ... MiaClasse = new MiaClasse ( ) ; var mioOggetto_n: MyClass = new MyClass (); |
It makes no sense:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class MyClass { MiaClass function () {} MioMetodo_2 function () {} } class MyClass { MiaClass function () {} MioMetodo_2 function () {} } class MyClass { MiaClass function () {} MioMetodo_3 function () {} } |
Object Instance and, therefore, coincide and are used alternately for the same meaning in different contexts.
Probably not much anyone cares ... the question of completeness of requirements ... ![]()











[...] If it is dry object oriented programming, I recommend reading at least Classes, Objects and Instances! [...]
[...] Static variables or constants are associated to the class and instance of the class! See Classes, Objects and Instances. This is an important difference, in fact if we write in our case - as a [...]