suppose we have two object;obj1 and obj2
can we assign obj2 to one1;
and if yes; then after assigning suppose we delete obj2
then obj1 will retain obj2 value or not.

Answers were Sorted based on User's Feedback



suppose we have two object;obj1 and obj2 can we assign obj2 to one1; and if yes; then after assign..

Answer / mahesh kotekar

Very tricky question, perhaps i would like to answer this
one with small coding.
Employee e1 = new Employee('mahesh','Software');
Employee e2 = e1;
e1 = null;

console.writeline(e2.FirstName);
Answer: We can assign the reference of the object to other
object. since both e1 and e2 refers to the same memory
location for the empllyee object. If we change the e1 then
refernce to memory of e1 will get deleted but e2 stil refers
to the same memory location Certainly it will work. and
retain the value.

Thanks And Regards
Mahesh KOtekar

Is This Answer Correct ?    7 Yes 0 No

suppose we have two object;obj1 and obj2 can we assign obj2 to one1; and if yes; then after assign..

Answer / jitender

we can assign the refrence of the object to other object.
since both object have the same memory . if we change the 1
obj then refrence to memeory of 1 obj will get deleted but 2
obj still refers to the same memory location certantily it
will work.

Is This Answer Correct ?    2 Yes 0 No

suppose we have two object;obj1 and obj2 can we assign obj2 to one1; and if yes; then after assign..

Answer / masthan

see this example
parentclass obj1=new parentclass();
childclass obj2=obj1;//assign object to the reference of
childclass.here both obj1 and obj2 refer same memory
location.
obj1=null;//here obj1 losts the memory
console.write(obj2);//it refers same memory location

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Explain the difference between asp.net mvc and asp.net webforms

0 Answers  


Can a master page inherit another master page?

13 Answers   Emphasis, IBM, NIIT, Sebiz Square,


what is client-server architecture in .net? and what is 3-tier architecture?

1 Answers  


Which adapter should you use, if you want to get the data from an access database?

0 Answers  


How do you set language in web.cofig ?

3 Answers   Keane India Ltd,






Where we create sessions for Banking Applications and how to create? expalin with code?

1 Answers   Wipro,


How to retrieve user name in case of Window Authentication?

0 Answers  


How to Open any web page by clicking any Any ASPControl like (Checkbox,radio button or Button) without calling its event and without going to Siverside code?

5 Answers   LG Soft,


Difference between overriding and overloading?

0 Answers  


What combination of methods are used to improve the speed of the fill() method of the DataAdapter? a) BeginFillData() and EndFillData() b) StartFillData() and EndFillData() c) BeginLoadData() and EndLoadData() d) StartLoadData() and EndLoadData()

2 Answers   Syntax Softtech, winfoware,


main difference between asp.net2.0,asp.net1.1,asp.net1.0

1 Answers   Northgate is,


in which protocol ASP.NET WEB API Work?

0 Answers   HCL,


Categories