Since StaticFoo, although static, is still considered part of the Sample class.
This can also be reproduced in C #:
public class Sample
{
private void PrivateBar()
{
Console.WriteLine("private called\r\n");
}
public static void StaticFoo()
{
Console.WriteLine("static called\r\n");
Sample y = new Sample();
y.PrivateBar();
}
}
class Program
{
static void Main(string[] args)
{
Sample.StaticFoo();
Console.Read();
}
}
With an exit:
static called
private called
source
share