Error using static : Static : Class Interface C# Source Code


Custom Search

C# Source Code » Class Interface » Static »

 

Error using static








    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/


using System; 
 
public class AnotherStaticError { 
  // non-static method. 
  void nonStaticMeth() { 
     Console.WriteLine("Inside nonStaticMeth()."); 
  } 
 
  /* Error! Can't directly call a non-static method 
     from within a static method. */ 
  static void staticMeth() { 
    nonStaticMeth(); // won't compile 
  } 
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Class Interface
» Static