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 {} } 

result

  • to determine derived's base class, need bind derived.inner2.
  • to bind derived.inner2, need resolve inner symbol.
  • the inner symbol inherited containing scope's base class, need determine derived's base class again.

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -