Hi
i have write below program but it is giving me error which i have bold , can any one help me..............?
public class Beginner
{
private static int x=35;
static void Main(string[] arg)
{
}
class something
{
Beginner boogie=new Beginner();
int y=boogie.x; // A field initilizer cannot reference the non-static field,method, or propery 'nestedClasses.Beginner.something.boogie
}
}

VulpesPosted Dec 29, 2011, 12:15 PM
int y = boogie.x;
to this:
int y = Beginner.x;
then it will work.
This is because x is a static field of the Beginner class and can therefore only be accessed by preceding it with the class name and a dot.