-1

Possible Duplicate:
Why does C# not provide the C++ style ‘friend’ keyword?

A typical example where it might be needed

I have a class with private Init() function and class factory which I would like to grant access to Init();

Community
  • 1
  • 1
Captain Comic
  • 15,744
  • 43
  • 110
  • 148
  • This is a duplicate question: [http://stackoverflow.com/questions/203616/why-does-c-not-provide-the-c-style-friend-keyword](http://stackoverflow.com/questions/203616/why-does-c-not-provide-the-c-style-friend-keyword) – Razzie Dec 16 '09 at 12:12

1 Answers1

-1

There are no friends in C#, it's true, but you can put these classes into same file, so they both will be able to access each other's functions. Or use "partial" classes, putting only init() function of each class into the same file where your factory resides

alemjerus
  • 8,023
  • 3
  • 32
  • 40
  • 2
    'but you can put these classes into same file' - that certainly doesn't grant access to private members. – Razzie Dec 16 '09 at 12:21