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

Is there an equivalent to the C++ friend keyword in C#?

Hi,

Is there an equivalent to the C++ friend keyword in C#?

Thanks
JF
Nov 16 '05 #1
3 3282
"Jean-Francois Hamelin" <ag************************@hotmail.com> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

Is there an equivalent to the C++ friend keyword in C#?


Nope. Only inner classes can see private members.

Also no multiple inheritence, no private inheritence, also only subtypes of
ValueType can be created on the stack, also no templates, also no anonymous
types.

David
Nov 16 '05 #2
Ahhh, the changes coming down the pike in C# 2.0... at least a few of those
things are finally addressed! ;)

--
HTH

Kyril Magnos

Question of the day:
What is Mono?
A) Disease where the lymph nodes become swollen.
B) A single sound
C) A synonym for one
D) A port of .NET meant to royally irritate MSFT
E) All of the above.

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:uC**************@TK2MSFTNGP10.phx.gbl...
| "Jean-Francois Hamelin" <ag************************@hotmail.com> wrote in
| message news:%2****************@TK2MSFTNGP09.phx.gbl...
| > Hi,
| >
| > Is there an equivalent to the C++ friend keyword in C#?
| >
|
| Nope. Only inner classes can see private members.
|
| Also no multiple inheritence, no private inheritence, also only subtypes
of
| ValueType can be created on the stack, also no templates, also no
anonymous
| types.
|
| David
|
|
Nov 16 '05 #3
Jean-Francois Hamelin wrote:

Hi,

Is there an equivalent to the C++ friend keyword in C#?

Thanks
JF


'internal' classes are about the closest thing that you can get.
Nov 16 '05 #4

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

Similar topics

3
by: Ike Naar | last post by:
Given the following C++ snippet: template < typename T > class A { // 1 public : // 2 class AA { } ; // 3 } ; ...
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;
7
by: Steve | last post by:
I'm just curious, why did give VB.Net a Friend keyword but not C#?
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...
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...
10
by: Bishoy | last post by:
Hi, In VB.NET there is a keyword called "My" which has a lot of properties collected at it. Is there any equivalent to this "My" in C#? Thank you.
12
by: rodchar | last post by:
hey all, vb has a static keyword for variables, what is charp's equivalent,please? static tempVar as String thanks, rodchar
5
by: kiran | last post by:
Hi all, How can we stop a base class to be derived in C++? In java we do that using final keyword. Is there a c++ equivalent? Thanks in advance, Kiran
2
by: Immortal Nephi | last post by:
I design a class for general purpose. I do not allow a client to read or modify interface and implemention. I allow them to write a new non- member function outside of class' interface and...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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.