473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Where is the good old Friend statement?

In C++ there was the friend statement. What about something like it in C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.

--
Regards
Sharon G.
Nov 16 '05 #1
4 4041
Sharon <Sh****@discussions.microsoft.com> wrote:
In C++ there was the friend statement. What about something like it in C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.


There is no equivalent of friend in C# currently, although there has
been talk about it (or something similar) appearing in .NET/C# 2.0.
Personally while I don't particularly hanker for friend access, I would
like to see namespace access (as Java has, although it's badly done
there - and Java doesn't have the equivalent of internal,
unfortunately).

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
The Friend statement is thankfully gone. A correctly designed architecture
doesn't need it. You should perhaps consider an interface.

For C# 2.0 Friend Assemblies will be available though. This will enable
access to the internal classes of an assembly. This is a change from the
current Internal access modifier that enables access to classes or members
in the same assembly which is possibly limiting for a component based
architecture relying on multiple assemblies.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Sharon" <Sh****@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
In C++ there was the friend statement. What about something like it in C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.

--
Regards
Sharon G.

Nov 16 '05 #3

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Sharon <Sh****@discussions.microsoft.com> wrote:
In C++ there was the friend statement. What about something like it in
C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.


There is no equivalent of friend in C# currently, although there has
been talk about it (or something similar) appearing in .NET/C# 2.0.


For clarities sake, the Friend Assemblies Bob mentioned is what is being
added. There is no explicit plans for any C++ like friend modifier that I am
aware of.
Nov 16 '05 #4

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Sharon <Sh****@discussions.microsoft.com> wrote:
In C++ there was the friend statement. What about something like it in
C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.


There is no equivalent of friend in C# currently, although there has
been talk about it (or something similar) appearing in .NET/C# 2.0.


For clarities sake, the Friend Assemblies Bob mentioned is what is being
added. There is no explicit plans for any C++ like friend modifier that I am
aware of.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bengt Richter | last post by:
We have where syntax in combination with suite expression syntax (bear with me, I think a good synergy will emerge ;-) ...
1
by: Mike - EMAIL IGNORED | last post by:
Are static friend functions allowed? I tried this today with gcc-3.2 without success. The function was not a class member. The friend statement was interpreted as meaning "extern", and this was...
9
by: John Cho | last post by:
// CHO, JOHN #include<iostream> class fracpri{ int whole; int numer; int denom;
4
by: Siemel Naran | last post by:
What is a good idiom for handling a lazy object? I see 2 good possibilities. Any more, any comments? Which way do people here use? (1) class Thing { public: Thing(double x, double y) :...
7
by: Mark P | last post by:
Is this legal and sensible? class Outer { friend struct Inner { ... }; ...
6
by: Andre Eisenbach | last post by:
Should this code compile or not? class A { void f(); }; class B { friend void A::f();
4
by: Tom Walker | last post by:
I cannot get the WHERE statement to work correctly unless I use a literal with the LIKE. I want to use a working storage data name so that I can vary the WHERE statement. Example that works: ...
2
by: anongroupaccount | last post by:
I have a smaller class that essentially acts as a record for a larger class (stored in a vector inside of the larger class). In a sense, it's splitting functionality over two classes. I don't...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.