c# - What does Eric Lippert mean by "you need to know what the base class is to determine what the base class is"? -
i read interesting article eric lippert, top 10 worst c# features. near end states:
the rules resolving names after aforementioned colon not founded; can end in situations need know base class in order determine base class is.
by colon referring inheritance operator (e.g. dog : animal
).
what situation eric referring to? can provide code sample?
this can happen in convoluted scenarios generics, inheritance, , nested classes:
class base<t> { public class inner {} } class derived : base<derived.inner2> { public class inner2 : inner {} }
- to determine
derived
's base class, need bindderived.inner2
. - to bind
derived.inner2
, need resolveinner
symbol. - the
inner
symbol inherited containing scope's base class, need determinederived
's base class again.
Comments
Post a Comment