none
MemberScope RRS feed

  • Question

  •         //class var
            public static char[] alpha = new char[26];

      public    static void small()
            {
                for (alpha[0] = 'a'; alpha[0] < 'z'; alpha[0]++)

                    Console.WriteLine("Small Letters");


            }

      public  static void capital()
            {
                for (alpha[25] = 'Z'; alpha[25] > 'A'; alpha[25]--)
                    Console.WriteLine("This capital Letter");

            }  




             static void Main(string[] args)
            {


                MemberScope Smalll = new MemberScope();
                Console.WriteLine(MemberScope.small)

    I get Error while printing memberscope

    • Edited by selvatori Tuesday, July 30, 2019 2:40 AM
    Tuesday, July 30, 2019 2:39 AM

Answers

All replies

  • Greetings Selvatori. Try this.
            static void Main(string[] args)
            {
    
    
                MemberScope Small = new MemberScope();
                Small.small();



    • Edited by Ante Meridian Tuesday, July 30, 2019 2:52 AM Wrong call again.
    Tuesday, July 30, 2019 2:51 AM
  • Greetings Selvatori. Try this.
            static void Main(string[] args)
            {
    
    
                MemberScope Small = new MemberScope();
                Small.small();

     'MemberScope.MemberScope.small()' cannot be accessed with an instance reference; qualify it with a type name instead



    Tuesday, July 30, 2019 4:20 AM
  • Oops. I didn't see that the 'small' method is static.

            static void Main(string[] args)
            {
    
    
                MemberScope.small();

    Tuesday, July 30, 2019 4:41 AM