Reputation: 31
I am a beginner programmer and have a question. My book says classes are examples of references types and I am a little confused by this. I know their objects created from them certainly would be, but why would the class itself be a reference type?
Upvotes: 1
Views: 112
Reputation: 726519
I know their objects created from them certainly would be, but why would the class itself be a reference type?
Objects created from classes are reference objects, while classes themselves are reference types.
However, classes themselves have a run-time representation presented to programmers in the form of an instance of a class called Class
. This makes classes reference objects, in addition to being reference types.
Upvotes: 1