Answer the question
In order to leave comments, you need to log in
What are objects of primitive value, reference types?
Right now I'm studying reflection and what's going on under the hood. The line reached the fields. I first considered them as separate from ordinary objects (value or reference) entity, but I was mistaken, as Jeffrey Richter's book says that
A field is a data member that stores an instance of a value type or a reference to a reference type., that is, it's the same variable, only it has a different location, so now I'll treat fields as simple objects of a reference or value type, and not as something foreign. And here the question arises, what are objects of primitive meaningful, reference types? I know what an object of a self-made class looks like, I know about the method table and EEClass, but it seems to me that objects of primitive reference types differ from objects of self-made types, and I have never heard anything about the interiors of objects of primitive (and even not primitive) value types , for now. So here are a few specific questions:
Answer the question
In order to leave comments, you need to log in
Access modifiers allow you to hide members from the rest of the code, reflection allows you to get access to them, I don’t remember if private methods can be called. The second thing in the object is the internal structure of EEClass. In unsafe mode, you can also pull it out, get a table of virtual methods.
Difference between
public class A
{
public int _age = 19;
}
public static void Main()
{
int age = 19;
}
is that 1 variable is at the class level, and the second at the method level. For example, you cannot access a method-level variable from a class or another method, but you can access a class-level variable both at the class level and at the method level.
All ValueType properties are open, base types like int have no properties at all, they are nailed to ValueType for beauty. They are a storage for numbers, just a set of bits, there is simply nowhere to be more primitive, machine instructions work with them, not methods. In the case of local variables, they may well exist only in processor registers or even be erased as unnecessary. This is the difference between age and _age, there is no other difference. As far as methods, how should framework code call hidden methods? There is no such thing.
What kind of descriptors? Google finds file and window handles...
PS Advanced books assume you have a basic understanding of how computers work and understand C.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question