What would be output of following program ?
class Program
{
static void Main(string[] args)
{
Student student = new Student();
Show(student);
Display(student);
student.P2 = "Main";
Console.WriteLine(student.P + " == " + student.P1 + " == " + student.P2 + " " + student.GetHashCode());
Console.ReadLine();
}
static void Show(Student student)
{
var localStudent = student;
localStudent.P = "Show";
}
static void Display(Student student)
{
var localStudent = student;
localStudent.P1 = "Display";
}
}
public class Student
{
public string P;
public string P1;
public string P2;
}
Output :
Show == Display == Main 46104728 - Random Address
No comments:
Post a Comment