Answer Posted / bhagyesh
class A
{
public A()
{
};
public int i;
}
class TestPerson
{
static void Main()
{
A a = new A();
A b;
a.i =5;
b=a; // not a deep copy
b.i = a.i+6;
}
}
here a.i=11 and b.i = 11 because a and b both refer same
instance of object
Deep copy would be implemented in c# using copy construction
class A
{
public A()
{
};
public A(A previouscopy)
{
i = previouscopy.i;
};
public int i;
}
class TestPerson
{
static void Main()
{
A a = new A();
a.i =5;
// Create another new object, copying a.
A b = new A(a); // Deep copy using copy constructor
b.i = a.i+6;
}
}
here a.i=5 and b.i = 11 because a and b both refer it's own
instance of object
Is This Answer Correct ? | 12 Yes | 3 No |
Post New Answer View All Answers
can any one find and tell the difference between dot net and php which one is best ? which one we get more salary? which one is stable and which one is best for freshers and also better in future and carrer ? which one we wil get more salary sir ? please send ur valuable suggestions to kiranpulsar2007@gmail.com
What r the asp.net list controls and diff. Between them?
Explain significance of routing? : asp.net mvc
In how many ways we can retrieve table records count?
How should I destroy my objects in asp.net?
How long should a session id be?
How to implement role based security in asp.net mvc? : Asp.Net MVC
What are the different types of cookies in asp.net?
What is a reflection?
Explain difference betn dataset and recordset?
What are validator? Name the validation controls in asp.net? How do you disable them?
what is publisher?
what cut off mark for po's,what questions they asked for interview?
What is Web API Routing?
Explain the updatepanel?