Hi,
I'm aware that C# allows you to call private methods of a different instance of a class provided you do it within that class, for example:
public class Foo
{
private void DoSomethingPrivate()
{
}
public void DoSomethingPublic(Foo differentInstance)
{
differentInstance.DoSomethingPrivate();
}
}
Even though DoSomethingPrivate() is private I'm allowed to call it on a different instance within class Foo only.
Is there a good reason why this is allowed? A type should trust itself?
Thanks for your help.