Re: static methods in an interface
Peter Ritchie <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
An interface is a definition of what a class instance should make publicly available. Since an instance is not static, you cannot declare static members in an interface. Also, since static members are not in any virtual table because they are not related to any particular instance, you cannot make a static member virtual--ergo you cannot mandate a class to implement specific static members to fulfil derivation. On Thu, 24 Aug 2006 15:10:12 -0400, Peter Osucha <[email protected]> wrote: >I have an interface defined with some methods. I have two classes that >implement this interface - however, I want the classes to implement the >methods statically. > >I tried setting the method definition to 'static' in the interface but >apparently, that's not allowed (I get an error 'The modifier 'static' is not >allowed for this item'). > >If I just try to use the 'static' modifier in the class that implements the >interface, I get another error telling me that the class does not implement >the interface method (which doesn't have the 'static' modifier). What is >going on here and why am I not allowed to create a 'static' method this way? >How might I accomplish what I am trying to do, please? =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com