private void MakeDemoCalls() { AccessDemo demo = new AccessDemo(); // Comes from the same project or assembly demo.InternalDemo(); demo.PublicDemo(); demo.ProtectedInternalDemo(); }
static void Main(string[] args) { AccessDemo demo = new AccessDemo(); // instance tida bisa akses ==> demo.PrivateProtectedDemo(); demo.ProtectedDemo(); demo.ProtectedInternalDemo(); demo.InternalDemo(); demo.PublicDemo(); // tidak bisa akses ke methode PrivateProtectedDemo(); ProtectedDemo(); ProtectedInternalDemo(); InternalDemo(); PublicDemo(); }
public void Demo() { AccessDemo demo = new AccessDemo(); // instance tida bisa akses: demo.PrivateProtectedDemo(); demo.ProtectedDemo(); demo.ProtectedInternalDemo(); demo.InternalDemo(); // method bisa akses melalui instance hanya untuk: demo.PublicDemo(); // tidak bisa akses methode ==> PrivateDemo() PrivateProtectedDemo(); InternalDemo(); // Method bisa diakses : ProtectedDemo(); ProtectedInternalDemo(); PublicDemo(); }