Web Log di Adrian Florea

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." Antoine de Saint-Exupery
posts - 440, comments - 2715, trackbacks - 3944

My Links

Archives

Post Categories

Image Galleries

.RO Blogs

.RO People

.RO Sites

Blogs

Furls

Links

vinCitori

System.Object come tipo base di un tipo interfaccia?

Alla pagina 129 (p. 145 del file PDF) dello "Standard ECMA-334, C# Language Specification, 2nd edition", ho incontrato una frase curiosa:

"If T is an interface-type, the base types of T are the base interfaces of T and the class type object" (le sottolineature in tutte le citazioni sono mie)

Un tipo interfaccia ha come tipo base anche System.Object? In che modo dobbiamo interpretare questa affermazione? Solo il fatto che "le interfacce sono sempre considerate come tipi di riferimento"? (Richter, p. 330) Come possiamo verificare via reflection il fatto che un'interfaccia ha come tipo base la System.Object?

Sempre Richter dice, alla pagina 326, che "le interfacce non provengono da alcun tipo derivato da System.Object" - e questo ci va bene, che non provengano da alcun tipo derivato, ma la mia domanda è: le interfacce provengono davvero da System.Object?

Se prendiamo "Essential .NET, Il CLR Volume 1" di Box & Sells, risulta in modo chiaro il contrario, che le interfacce non derivano da System.Object:

"Oltre a dichiarare la compatibilità con più interfacce, un tipo può anche specificare al massimo un tipo base. Un tipo base non può essere un'interfaccia e, parlando in senso stretto, le interfacce supportate da un tipo non sono considerate come suoi tipi base. Inoltre, le stesse interfacce non hanno un tipo base. Piuttosto, al massimo, un'interfaccia supporta altre interfacce proprio come nel caso dei tipi concreti. Per i tipi (non interfacce) che non specificano un tipo base viene usato come base System.Object" (pp.69-70)

Cosa credere?

Print | posted on domenica 27 giugno 2004 18:17 | Filed Under [ Carillon .NET ]

Powered by:
Powered By Subtext Powered By ASP.NET