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

How to solve the problem of the accessibility of members ?

How to solve the problem of the accessibility of members among files( .h or
..cpp )
in __gc classes?

Ex :

// AA.h file
public __gc class AA : UserControl
{
/* snip */
};

// BB.h file
public __gc class BB : UserControl
{
access-specifier int _b ;
/* snip */
};
AA can access _b of BB and all the classes can't except AA.
I can do it using "friend" if not __gc class.
How to do it on __gc class?

BTW, what is the reason that MS has removed "friend" in __gc class?

Thank.
Nov 16 '05 #1
6 1160
stephan wrote:
I can do it using "friend" if not __gc class.
How to do it on __gc class?
declare it as "private public:" or "protected public:"

BTW, what is the reason that MS has removed "friend" in __gc class?


They introduced a new feature...
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp
Nov 16 '05 #2
stephan wrote:
How to solve the problem of the accessibility of members among files(
.h or .cpp )
in __gc classes?

Ex :

// AA.h file
public __gc class AA : UserControl
{
/* snip */
};

// BB.h file
public __gc class BB : UserControl
{
access-specifier int _b ;
/* snip */
};
AA can access _b of BB and all the classes can't except AA.
I can do it using "friend" if not __gc class.
How to do it on __gc class?

BTW, what is the reason that MS has removed "friend" in __gc class?


There's no support for friend access in the CLR. You'll have to change your
design to not rely on friends if you're targeting the CLR.

-cd
Nov 16 '05 #3
"Jochen Kalmbach" wrote :

declare it as "private public:" or "protected public:"


If there are AA and BB on the *same* file, these access-specifiers
work. If not, they don't work. Both AA and BB were inherited from
class "UserControl". therefore, there can't be AA and BB on the same file.

Thanks.

Nov 16 '05 #4
"Carl Daniel [VC++ MVP]" wrote :

There's no support for friend access in the CLR. You'll have to change your design to not rely on friends if you're targeting the CLR.


Forgive me. what is the reason that MS don't support friend access in the
CLR?


Nov 16 '05 #5
stephan wrote:
"Carl Daniel [VC++ MVP]" wrote :

There's no support for friend access in the CLR. You'll have to
change your design to not rely on friends if you're targeting the
CLR.


Forgive me. what is the reason that MS don't support friend access
in the CLR?


friend access is generally considered dangerous, even in C++. I suppose
they decided there wasn't a sufficiently compelling reason to allow it.

-cd
Nov 16 '05 #6
You can get somewhat of an equivalent by making the members public and using
a declarative code access security check for the identity of the immediate
caller.

Note that in practice in standard C++ you can get around any accessibility
of members by casting or any variant of techniques whereas on the CLR
platform there is a hard enforcement of the accessibility.

Ronald Laeremans
Visual C++ team

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
stephan wrote:
"Carl Daniel [VC++ MVP]" wrote :

There's no support for friend access in the CLR. You'll have to
change your design to not rely on friends if you're targeting the
CLR.


Forgive me. what is the reason that MS don't support friend access
in the CLR?


friend access is generally considered dangerous, even in C++. I suppose
they decided there wasn't a sufficiently compelling reason to allow it.

-cd

Nov 16 '05 #7

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

Similar topics

1
by: Hans De Schrijver | last post by:
I'm pretty new to C# development, so here's a newby question regarding accessibility: Scenario: class1 contains some basic properies and methods class2 inherits from class1 and adds some...
4
by: waltborders | last post by:
Hi, Because the blind are unable to use a mouse, keyboard navigation is key. A major difficulty is that not all windows forms controls are keyboard 'tab-able' or 'arrow-able' or have "tab...
1
by: Jeff | last post by:
Hey asp.net 2.0 I'm developing a webportal. Some info within the portal is available for anonymous users, but most info is available to logged in members... So I uses LoginView to show...
16
by: Hooyoo | last post by:
Following are similar codes of my project: At first I define two classes in two files: //ClassA.h #pragma once #include "ClassB.h" class ClassA { public: ClassA(void){};
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
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...
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
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
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.