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
What is a generic in c#?
Why do we need indexer in c#?
What are abstract classes in c#?
What is master page in asp net c#?
What are logical operators in c#?
What is an inheritance ?Give an example in which inheritance is used?
What is Covariance and contravariance in C#?
What is the meaning of extention?
Differentiate between static class and singleton instance?
Hi Friends, I am going through Siemens Interview Procedure from last 1+1/2 months. I went through 1 written + 2 Technical + 1 Managerial Round process after which I got call from HR informing that "you are selected and we would like to meet you for HR round". HR round was very nominal compared to MR. HR Round last for hardly 5 mins. They told me that you will get the final result on Friday. Still I have not received any feedback from them. Please help!!!
How do I join one form to another in c#?
What is trim in c#?
Can we assign null value to integer?
Explain About .NET Framework
Can abstract classes be final?