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

How does bitwise xor work?

843


Why do we use lambda expression in c#?

896


What are the uses of namespaces?

959


How many bytes is an int?

859


Which is faster dictionary or list?

869


Can you specify an access modifier for an enumeration?

928


What do you mean by the delegate in c#?

852


Explain About Web.config

920


What is difference between destructor and finalize?

859


Is there a way of specifying which block or loop to break out of when working with nested loops?

949


How can we set the class to be inherited, but prevent the method from being over-ridden?

920


Why do we use static class in c#?

856


What is hash c#?

885


What are Types of assemblies that can be created in dotnet

981


Who introduced c#?

814