Ejemplo n.º 1
0
        private void MakeDemoCalls()
        {
            AccessDemo demo = new AccessDemo();

            demo.PublicDemo();
            demo.InternalDemo();
            demo.ProtectedInternalDemo();
        }
Ejemplo n.º 2
0
        private void MakeDemoCalls()
        {
            AccessDemo demo = new AccessDemo();

            //will call public, protectedInternal and internal methods

            demo.PublicDemo();
            demo.ProtectedInternalDemo();
            demo.InternalDemo();
        }
Ejemplo n.º 3
0
        private void MakeDemoCalls()
        {
            AccessDemo demo = new AccessDemo();

            // Private demo method is not directly accessible here either outside of its declaring class!
            // Internal and protected internal are accessible here though (as well as public)

            demo.InternalDemo();

            InheritFromAccessDemo demo2 = new InheritFromAccessDemo();

            demo2.ProtectedInternalDemo();

            // Cannot call private protected method from here that is in the same assembly
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        private void MakeDemoCalls()
        {
            AccessDemo demo = new AccessDemo();

            demo.InternalDemo();
        }