Re: Defining Static Members in an Interface
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sun, 3 Apr 2005 07:14:14 +0100
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
.
- Follow-Ups:
- Re: Defining Static Members in an Interface
- From: Bruce Wood
- Re: Defining Static Members in an Interface
- References:
- Defining Static Members in an Interface
- From: Dale
- Re: Defining Static Members in an Interface
- From: Bruce Wood
- Defining Static Members in an Interface
- Prev by Date: Re: Overriding Inherited Propeties
- Next by Date: Lost auto event coding
- Previous by thread: Re: Defining Static Members in an Interface
- Next by thread: Re: Defining Static Members in an Interface
- Index(es):
Relevant Pages
|