Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Differentiate between dataset and datareader?

946


What are get and set in c#?

983


What is the output of TextWriterTraceListener redirected?

1039


What is the signature of a method?

915


How can I produce an assembly?

1020


Why do we need interfaces in c#?

881


What is addressof operator?

939


What is the advantage of constructor?

875


How to use session under class file of APP_Code folder?

998


What is callback method in c#?

915


Define xslt.

919


What is a value type in c#?

950


What is the system namespace?

896


What is the difference between IEnumerator and IEnumerable?

1157


in object oriented programming, how would you describe encapsulation?

1005