Sign in to follow this  
Endar

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

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this