private void MakeDemoCalls() { AccessDemo demo = new AccessDemo(); demo.PublicDemo(); demo.InternalDemo(); demo.ProtectedInternalDemo(); }
private void MakeDemoCalls() { AccessDemo demo = new AccessDemo(); //will call public, protectedInternal and internal methods demo.PublicDemo(); demo.ProtectedInternalDemo(); demo.InternalDemo(); }
private void MakeDemoCalls() { AccessDemo demo = new AccessDemo(); // demo.PrivateDemo(); // you can not access a private method/property/variable from outide the class (at least directly) demo.InternalDemo(); // it is possible because it's the same assembly (visibility internal) // can I consider assembly = namespace? demo.PublicDemo(); demo.ProtectedInternalDemo(); // same assembly but does not inherit }
public void Test() { AccessDemo demo = new AccessDemo(); // instance tida bisa akses ==> demo.PrivateProtectedDemo(); demo.ProtectedDemo(); // method bisa akses melalui instance hanya untuk: demo.ProtectedInternalDemo(); demo.InternalDemo(); demo.PublicDemo(); // tidak bisa akses methode PrivateDemo() Ancestor PrivateProtectedDemo(); ProtectedDemo(); ProtectedInternalDemo(); InternalDemo(); PublicDemo(); }
private void MakeDemoCall() { AccessDemo demo = new AccessDemo(); // instance tida bisa akses ==> demo.PrivateProtectedDemo(); demo.ProtectedDemo(); // method bisa akses melalui instance hanya untuk: demo.ProtectedInternalDemo(); demo.InternalDemo(); demo.PublicDemo(); // tidak bisa akses ke methode PrivateProtectedDemo(); ProtectedDemo(); ProtectedInternalDemo(); InternalDemo(); PublicDemo(); }