What could be output of below code block:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Int32 varInt = 0;
String strTestString = String.Empty;
strTestString = "Before Function Call String Object";
varInt = 987;
test userObj = new test();
userObj.n = 34;
userObj.str = "Before Function call Test Object";
check(userObj, varInt,strTestString);
Response.Write("</br>"+userObj.n);
Response.Write("</br>" + userObj.str);
Response.Write("</br>" + varInt);
Response.Write("</br>" + strTestString);
}
public void check(test userObjRec,int varIntRec,String strTestStringRec)
{
userObjRec.n = 110;
userObjRec.str = "After Function call Test Object";
varIntRec = 555;
strTestStringRec = "After Function Call String Object";
}
}
public class test
{
public int n;
public String str;
}
.
.
Output
V
.
.
.
.
.
.
.
.
.
.
.
.
.
Output:-
110
After Function call Test Object
987
Before Function Call String Object
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Int32 varInt = 0;
String strTestString = String.Empty;
strTestString = "Before Function Call String Object";
varInt = 987;
test userObj = new test();
userObj.n = 34;
userObj.str = "Before Function call Test Object";
check(userObj, varInt,strTestString);
Response.Write("</br>"+userObj.n);
Response.Write("</br>" + userObj.str);
Response.Write("</br>" + varInt);
Response.Write("</br>" + strTestString);
}
public void check(test userObjRec,int varIntRec,String strTestStringRec)
{
userObjRec.n = 110;
userObjRec.str = "After Function call Test Object";
varIntRec = 555;
strTestStringRec = "After Function Call String Object";
}
}
public class test
{
public int n;
public String str;
}
.
.
Output
V
.
.
.
.
.
.
.
.
.
.
.
.
.
Output:-
110
After Function call Test Object
987
Before Function Call String Object
No comments:
Post a Comment