Re: Defining Static Members in an Interface

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Bruce Wood <brucewood@xxxxxxxxxx> wrote:
> (Notwithstanding this I had a surreal experience recently in which
> Visual Studio was allowing me to refer to static methods in a parent
> class using the child class's class name. I'm still wondering what
> happened there: that's not supposed to be allowed.) :-/

Yes it is - i.e. you can use UnicodeEncoding.ASCII, even though the
ASCII property is declared in Encoding.

The first part of member lookup is:

<quote>
First, the set of all accessible (§10.5) members named N declared in T
and the base types (§14.3.1) of T is constructed.
</quote>

I think it's a bad idea to refer to a static member via a derived type
name, but it's legal.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Common ancestor between man and ape
    ... simply refer to classes of organisms, which can be reassigned as new ... Nor is it incorrect to refer to a member of Pongidae ... as an 'ape', but the reason we call it an 'ape' is because it is ... The reason it is not incorrect to call a member of Insecta an 'insect' ...
    (talk.origins)
  • Re: Common ancestor between man and ape
    ... simply refer to classes of organisms, which can be reassigned as new ... Nor is it incorrect to refer to a member of Pongidae ... The reason it is not incorrect to call a member of Insecta an 'insect' ...
    (talk.origins)
  • Re: Common ancestor between man and ape
    ... simply refer to classes of organisms, which can be reassigned as new ... incorrect to refer to a member of 'Insecta' as 'an ... Nor is it incorrect to refer to a member of Pongidae ...
    (talk.origins)
  • Re: Common ancestor between man and ape
    ... simply refer to classes of organisms, which can be reassigned as new ... Nor is it incorrect to refer to a member of Pongidae ... as an 'ape', but the reason we call it an 'ape' is because it is ... The reason it is not incorrect to call a member of Insecta an 'insect' ...
    (talk.origins)
  • Re: Common ancestor between man and ape
    ... simply refer to classes of organisms, which can be reassigned as new ... incorrect to refer to a member of 'Insecta' as 'an ... Nor is it incorrect to refer to a member of Pongidae ...
    (talk.origins)