PublicMethod() 공개 메소드

public PublicMethod ( ) : void
리턴 void
예제 #1
0
    public void SomeMethod()
    {
        PublicClass c = new PublicClass();

        c.PublicMethod();           //Valid
        c.ProtectedMethod();        //Invalid, not accessible
        c.PrivateMethod();          //Also invalid
    }
예제 #2
0
        static void MainX(string[] args)
        {
            var obj = new PublicClass();

            Console.WriteLine(obj.PublicMethod());
            //Console.WriteLine(obj.PrivateMethod());
            //Console.WriteLine(obj.InternalMethod());

            //var obj1 = new InternalClass();
        }
예제 #3
0
파일: 3-2.cs 프로젝트: Librazy/CSharpLabs
            private static void Main()
            {
                Console.WriteLine(new Inside.InternalInsideClass());
                Console.WriteLine(new InternalClass());
                var pub = new PublicClass();

                Console.WriteLine(pub);
                pub.PublicMethod();
                pub.InternalMethod();
                //pub.ProtectedMethod();
                //pub.PrivateMethod();

                Console.WriteLine(new PublicClass.PublicNestedClass());
                //Console.WriteLine(new PublicClass.ProtectedNestedClass());
                //Console.WriteLine(new PublicClass.PrivateNestedClass());

                Console.WriteLine(new SubClass());

                var sub = new Sub("test");

                Console.WriteLine(sub.Name);
                sub.BaseVirtualMethod();
                Console.WriteLine(sub.Name);
            }