I'm a C++ developer learning C#, and I'm in a situation where I need a class C to have two members that belong to it that represent "robots." The robots need to be able to access private members of C, and they don't need to be used anywhere else. In C++ I'd use the "friend" keyword, but I don't know what to do here. I thought about doing something like this:
class C
{
private Member mem;
private Robot bot;
private class Robot
{
C owner;
public void function() { //Robot needs to use owner.mem here,
//but can't because it's private}
};
}
The trouble is that I don't know how to say that a Robot is "owned" by an instance of C, and can access its members.