Hi all,
I have three classes, all within the same assembly and namespace. When I compile I get:
"Inconsistent accessibility: parameter type 'Foo' is less accessible than method MyClass.VirtualMethod(Foo)"
"Inconsistent accessibility: parameter type 'Foo' is less accessible than method MySubClass.VirtualMethod(Foo)"
I don't understand why!
Code sample below will produce error:
To my mind, the lack of modifier on class Foo makes it internal, therefor I don't see the problem. I can fix the compilation error by making the virtual method 'internal' rather than 'protected internal' but would like to understand why I get the compilation error.
Any explanation greatly appreciated!
Thanks,
Graeme
"Just beacuse you're paranoid, don't mean they're not after you
I have three classes, all within the same assembly and namespace. When I compile I get:
"Inconsistent accessibility: parameter type 'Foo' is less accessible than method MyClass.VirtualMethod(Foo)"
"Inconsistent accessibility: parameter type 'Foo' is less accessible than method MySubClass.VirtualMethod(Foo)"
I don't understand why!
Code sample below will produce error:
Code:
public class MyClass
{
public static void Main()
{
}
protected internal virtual void VirtualMethod(Foo foo)
{
// nothing here
}
}
public class MySubClass: MyClass
{
protected internal override void VirtualMethod(Foo foo){
// overridden method
}
}
class Foo
{
public string myString;
}
To my mind, the lack of modifier on class Foo makes it internal, therefor I don't see the problem. I can fix the compilation error by making the virtual method 'internal' rather than 'protected internal' but would like to understand why I get the compilation error.
Any explanation greatly appreciated!
Thanks,
Graeme
"Just beacuse you're paranoid, don't mean they're not after you