//Static Nested Class
using System;
public class A
{
int y;
public static class B
{
static int x;
public static void F()
{
x = 10;
Console.WriteLine("IN B , X is"+x);
}
}
}
class Program
{
public static void Main()
{
A.B.F();
}
}
//Non Static Nested Class
using System;
public class A
{
int y;
public class B
{
int x;
public void F()
{
x = 10;
Console.WriteLine("IN B , X is"+x);
}
}
}
class Program
{
public static void Main()
{
A.B obj = new A.B();
obj.F();
}
}
No comments:
Post a Comment