473,320 Members | 1,876 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,320 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 13965
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#?
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.