473,439 Members | 1,828 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,439 software developers and data experts.

Why doesn't c# have Friend keyword like VB.Net

I'm just curious, why did give VB.Net a Friend keyword but not C#?
Nov 15 '05 #1
7 13970
Who says it doesn't? I believe the equivalent is 'internal'.
"Steve" <an*******@discussions.microsoft.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
I'm just curious, why did give VB.Net a Friend keyword but not C#?

Nov 15 '05 #2
Because C# uses more c-like terminology. See "Protected Internal"

Nick Harris, MCSD
http://www.VizSoft.net

"Steve" <an*******@discussions.microsoft.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
I'm just curious, why did give VB.Net a Friend keyword but not C#?

Nov 15 '05 #3
Hi Steve,

"Steve" <an*******@discussions.microsoft.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
I'm just curious, why did give VB.Net a Friend keyword but not C#?


VB: Friend ~= C#: internal

Regards,
Dan
Nov 15 '05 #4
100
Steve,
*Friend* keyword in VB is not the same as *friend* in c++. .NET doesn't
support *friend visibility* and it is not a matter of language. VB *Friend*
is equivalent to *internal* in c#

B\rgds
100

"Steve" <an*******@discussions.microsoft.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
I'm just curious, why did give VB.Net a Friend keyword but not C#?

Nov 15 '05 #5
I would say C# is more like C++ then C. C++ had a friend concept.

"Nick Harris" <nh*****@VizSoft.net> wrote in message
news:#V**************@TK2MSFTNGP09.phx.gbl...
Because C# uses more c-like terminology. See "Protected Internal"

Nick Harris, MCSD
http://www.VizSoft.net

"Steve" <an*******@discussions.microsoft.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
I'm just curious, why did give VB.Net a Friend keyword but not C#?


Nov 15 '05 #6
Yes, C++ had a friend concept, and this is exactly why it isn't called
"friend" in C#---so it wouldn't confuse C++ programmers who would expect
friend to work like it does in C++.

Friend in VB.NET works like Friend in VB6, which is also how internal works
in C#.

And to Nick: I wouldn't say "protected internal" is the same as VB's
"Friend" because VB.NET also has a combination of "Friend" and
"Protected" --- "Protected Friend".

--Matthew W. Jackson

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:eO**************@TK2MSFTNGP09.phx.gbl...
I would say C# is more like C++ then C. C++ had a friend concept.

"Nick Harris" <nh*****@VizSoft.net> wrote in message
news:#V**************@TK2MSFTNGP09.phx.gbl...
Because C# uses more c-like terminology. See "Protected Internal"

Nick Harris, MCSD
http://www.VizSoft.net

"Steve" <an*******@discussions.microsoft.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
I'm just curious, why did give VB.Net a Friend keyword but not C#?



Nov 15 '05 #7
X-No-archive: yes
thanks guys, I re-read the docs; it is the same as c# internal.
Nov 15 '05 #8

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

Similar topics

21
by: Sebastian Faust | last post by:
Hi, is a construction like the following possible: template<class view_model> class template_clase { protected: template_clase() {} virtual ~template_clase() {}
3
by: Robert Wierschke | last post by:
Hi I want to overload the operator<< for a class Vector. class Vector { double x; double y; double z;
3
by: CoolPint | last post by:
After upgrading to gcc 3.4.2 from gcc 3.2.3, I got compiler errors that I could not figure out. After reading other postings, I learned that my coding was not compliant to the standard in the first...
5
by: Teddy | last post by:
Hello all consider the class Date declaretion below: class Date { public: Date(); Date(int year, int month, int day); Date(const string&); int getYear() const;
43
by: Zeng | last post by:
It's so messy w/o the "friend" relationship. Does anyone know why it was not supported in C#. It's almost about as bad as it doesn't support the inheritance hierarchy and method reference...
7
by: Jesper | last post by:
I need to grant a class access to protected fields of another class in the way its possible in C++ with the friend keyword. However I would like to keep the class protected towards other class...
3
by: Ben Galvin | last post by:
Hi, I'm looking for an equivalent to the C++ 'friend' keyword in C# (for those who don't know, this lets you give a specific class access to all the private/protected members of another class)....
8
by: Paul Cheetham | last post by:
Hi, I am writing an application with a large number of various classes, and I want some of them to have Friend access to protected members of other classes. i.e. I want class A to have access...
3
by: Steve | last post by:
I'm just curious, why did give VB.Net a Friend keyword but not C#?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.