Access Private Members

How will you access private members of a class without using Reflection?

Questions by selvimathi   answers by selvimathi

Showing Answers 1 - 6 of 6 Answers

By Creating Property, for eg: private int x;


Now if we want to access it we have to make a property

Public int xx
{
get
{
return x;
}
set
{
x=value;
}
}

Now in main when you create an instance of class then just use that property and access it

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions