You are on page 1of 4

CLASS INSIDE CLASS

using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;

namespace ConsoleApplication1
{
public class prog
{
static void Main(string[] args)
{
a obj1 = new a();
a.b obj = new a.b();
obj.disp();
Console.ReadKey();
}
}
public class a
{
public int y = 20;
public class b
{
public int x = 10;
public void disp()
{
Console.WriteLine("VALUE FOR x is: " + x + " ");
}
}
}
}

STRUCTURE INSIDE CLASS


using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;

namespace ConsoleApplication2
{
public class prog
{
static void Main(string[] args)
{
a obj1 = new a();
a.b obj = new a.b(20);
obj.disp();
Console.ReadKey();
}
}
public class a
{
public int m = 20;
public struct b
{
public int x;
public b(int y)
{
x = y;
}
public void disp()
//static method
{
Console.WriteLine("VALUE FOR x is: " + x + " ");
}
}
}
}

STRUCTURE INSIDE STRUCTURE

using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;

namespace ConsoleApplication3
{
public class prog
{
static void Main(string[] args)
{
a obj1 = new a();
a.b obj = new a.b(30);
obj.disp();
Console.ReadKey();
}
}
public struct a
{
public int m ;
public struct b
{
public int x;
public b(int y)
{
x = y;
}
public void disp()
//static method
{
Console.WriteLine("VALUE FOR x is: " + x + " ");
}
}
}
}

CLASS INSIDE STRUCTURE


using System;

using
using
using
using

System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;

namespace ConsoleApplication4
{
public class prog
{
static void Main(string[] args)
{
a obj1 = new a();
a.b obj = new a.b();
obj.disp();
Console.ReadKey();
}
}
public struct a
{
public int m;
public class b
{
public int x=40;
public void disp()
//static method
{
Console.WriteLine("VALUE FOR x is: " + x + " ");
}
}
}
}

You might also like