Jump to content
  • Advertisement
Sign in to follow this  
Endar

[.net] [C#] internal, assembly and C++ friends

This topic is 4056 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking for the C# equivalent of a C++ friend class modifier. Apparently you can use the 'internal' keyword to implement unrestricted access within the same assembly, but what exactly is defined as an assembly? Does the code/classes have to be in the same file? Is the executable defined as a single assembly?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Rattenhirn
That's right. Assembly is a .dll or .exe file.

So then there is nothing that will allow a single class unrestricted access to another's members? Assuming that the classes are completely seperate and not related (inherited, etc) in any way.

Share this post


Link to post
Share on other sites
Drat.

Now, is that a good thing or a bad thing? Because I've occasionally found it useful for certain design decisions in C++.

Share this post


Link to post
Share on other sites
In C#, the only way I know of to give one class access to the other's private data is to make it a nested class.

Share this post


Link to post
Share on other sites
Quote:
Original post by dalleboy
Quote:
Original post by SnOrfys
friend classes are a bad oop practice.

It depends on who you ask.


Very true.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!