using System;
namespace Structur
{
struct StructName
{
public int x, y;
}
class Class1
{
public int x, y;
}
class Program
{
static void Main(string[] args)
{
StructName StructVar;
StructVar.x = 10;
StructVar.y = 30;
Console.WriteLine(StructVar.x); //10
Console.WriteLine(StructVar.y); //30
StructName StructVar2;
StructVar.x = 100;
StructVar2 = StructVar; //Copy Data
Console.WriteLine(StructVar2.x); //10
Console.WriteLine(StructVar2.y); //30
Class1 obj = new Class1();
obj.x = 34535;
obj.y = 654654;
Console.WriteLine(obj.x);
Console.WriteLine(obj.y);
Class1 Obj2;
Obj2 = obj; // Copy Address
obj.x = 1000;
Console.WriteLine(Obj2.x);
Console.WriteLine(Obj2.y);
Console.ReadKey();
}
}
}
No comments:
Post a Comment