Re: abstract class 'does not implement interface member ...'

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



On Jun 19, 10:48 am, "Christof Nordiek" <c...@xxxxxxxxx> wrote:
However, that wouldn't solve your problem here - because interface
members are themselves implicitly public, so all the implementations
have to be public. It's very odd that the interface being internal
doesn't make all its members internal too.

If the interface is public, all it's implemantations have to be public. But
if the interface is internal, the implementation of it's members remain
internal if they are implemented implicitly.

No they don't - they have to be declared public:

using System;

internal interface IFoo
{
void Bar();
}

class Test : IFoo
{
static void Main()
{
}

internal void Bar()
{
}
}

fails to compile with the error:
Test.cs(8,7): error CS0536: 'Test' does not implement interface member
'IFoo.Bar()'. 'Test.Bar()' is either static, not public, or
has the
wrong return type.

You *have* to make the method public in order to implement the
interface implicitly.

At least, that's as far as I can see - could you give an example of
what you mean?

Jon

.



Relevant Pages

  • Re: Visitor pattern, code generation and additional sub classes
    ... this is a base class / interface. ...     void visitFoo; ... in all my visitor implementations ... ...
    (comp.object)
  • Re: php 5 classes: public, protected and private
    ... Private members can be accessed by members of the class only. ... Intefaces are not necessary in PHP. ... Once you have defined a method it is a total waste to time to also define an interface. ... Encapsulation means the internals of an object are managed only by that object and are not available to anyone else. ...
    (comp.lang.php)
  • Re: php 5 classes: public, protected and private
    ... Private members can be accessed by members of the class only. ... Intefaces are not necessary in PHP. ... the interface is the way to interact with the ... Two of the concepts in OO are 'encapsulation' and 'methods'. ...
    (comp.lang.php)
  • Re: frmN.Label31.Text = frmTitle does not work in VB.net
    ... This subroutine formsize is called by every Form*_Load event in VB6, ... members that do not exist for that type. ... The big difference is that we now have inheritance and interfaces. ... The other way is declare and implement an Interface in all your ...
    (microsoft.public.dotnet.languages.vb)
  • Re: php 5 classes: public, protected and private
    ... Private members can be accessed by members of the class only. ... Intefaces are not necessary in PHP. ... Once you have defined a method it is a total waste to time to also define an interface. ... Encapsulation means the internals of an object are managed only by that object and are not available to anyone else. ...
    (comp.lang.php)