Answer the question
In order to leave comments, you need to log in
Interface inheritance and interface typecasting: are they added to class metadata?
The class implemented the interface. If any object, but of the same interface type, is passed to one of its methods, then it will be possible to work with this one. In .NET, as far as I understand, each type and object has its own metadata. When interfaces are inherited, class and interface metadata are combined into one?
That is, there is one object of the type in memory - both with descriptions of methods with static fields (if any), and with descriptions of interface methods?
Or does the type metadata have a link to the inherited interface metadata, and when the "smart hint" and the compiler work, they first look into the object's metadata, and then follow the link to the interface's metadata and look there?
Answer the question
In order to leave comments, you need to log in
Perhaps I did not understand the question, but anyway, in the meta-info about the class there is info about the interfaces that it implements (it would be strange if it were not there :)). Because both the assembly and the full name of the interface are specified, and nothing prevents IDEs from going through the type tree and looking where everything is.
Offtopic: because. there is nothing to "inherit" from the interface, it is customary to say that the interface is "implemented" by the class to emphasize the difference from inheritance, when, in addition to establishing the is-a relationship, some implementation is also inherited by the class. The fact that in the class description both the base class and interfaces are listed in one list does not mean that the essence is the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question