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

Name some string escape sequences in c#.

1003


What is var c#?

938


who is a protected class-level variable available to?

985


Why objects are stored in heap in c#?

909


Which types of inheritances does c# support?

867


Is it possible to inline assembly or il in c# code?

995


Explain hash table in c# ?

1040


What are reflections in c#?

866


How can encapsulation be achieved?

1067


Can a static class have a constructor c#?

874


What is the difference between a variable and a literal?

1016


What is Wrapper class in dot net?

1031


What's the c# syntax to catch any possible exception?

992


What is ienumerable and iqueryable?

877


What is use of hashtable in c#?

842