Error using static

image_pdfimage_print
   

/*
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 
  } 
}