Is there any way to access private memebers of an object
from another object?
Answer Posted / rajesh
In C++ we can access private members of one class by the
object of another class,befor that we have to
make "friend"(keyword) the respective member of the first
class to the second class
for ex:
class A
{
private void display();
};
inherits: class B
{
friend void display();
};
Now we can acess the 'display' function using classB
object.We can only make friend to the immediate inherited
class and not to all classes under inheritance.
and in C# we have to create a property as first answer
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Explain dataadapter.update method in .net?
What do you mean by object pooling?
What are functions in c#?
what is a structure in c#
What are the benefits of using windows services:
What is c-sharp (c#)?
Why do we need events in c#?
Explain nullable types in c#?
What is a static field?
What is static classes in c#?
What is arraylist?
What is xpath in c#?
How can I get around scope problems in a try/catch?
What does void do in c#?
What is private void in c#?