I tried to develop a program to understand the concept given in the following website (http://en.csharp-online.net/Value_vs_Reference). This program is incomplete please complete this program to demonstrate the concept given in the website.
using System;
namespace Value_vs_Reference
{
class Program
{
static void Main(string[] args)
{
ReferenceType refType = new ReferenceType();
ValueType valueType = new ValueType();
refType.setR(5);
valueType.setV(10);
Console.WriteLine("{0} {1}", refType.getR(), valueType.getV());
Console.WriteLine("\nAfter assigning value");
refType.setR(6);
valueType.setV(11);
Console.WriteLine("{0} {1}", refType.getR(), valueType.getV());
Console.ReadKey();
}
}
}
class ReferenceType
{
int num;
public void setR(int num)
{
this.num = num;
}
public int getR()
{
return num;
}
}
struct ValueType
{
int num;
public void setV(int num)
{
this.num = num;
}
public int getV()
{
return num;
}
}