Ok this is bugging me.. I know I\'ve read it somewhere and google isn\'t helping.
What is the accessibility level of a method that does not specify an access modifie
Oh wait, there's one more thing ....
interface
method declarations are of course public
by definition. So the following implementation is public
, without an explicit access modifier.
public class MyClass : IEqualityComparer<MyClass>
bool IEqualityComparer<MyClass>.Equals(MyClass x , MyClass y) {}
}
Yes, internal
is the default for classes, but private
is the default for members.
Class methods are private and sealed by default in .NET. This means the method is only visible within the class and cannot be overridden by the inherited class.
hope this clarifies all as per screenshot directly from MSDN
For a class: Internal is the default if no access modifier is specified.
For a method: Private is the default if no access modifier is specified.
Assuming this is a C# method, since you have the ".net" tag.
People need to differentiate between "member" accessibility and "class" accessibility.