473,666 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pointers to managed types as members of a __gc class

m
Hi,
I'm reading Microsoft Visual C++ .NET Step by Step, Version 2003 and I found
a sentence it says :
"you can't have pointers to managed types as members of a __gc class.".

Why ?
Thanks,
Michele

Nov 17 '05 #1
3 1217
Are you sure it doesnt' mean they can't be members of non __gc classes?
If you want one as a member of a non-gc class, you use

gcroot<MangedOb ject_c*> m_ManagedPointe r;

In a __gc class, you just store them as normal pointers.

Cheers

Russell

m wrote:
Hi,
I'm reading Microsoft Visual C++ .NET Step by Step, Version 2003 and I found
a sentence it says :
"you can't have pointers to managed types as members of a __gc class.".

Why ?
Thanks,
Michele

Nov 17 '05 #2
m
Hi,
I'm just cutting and paste the exact text from the ebook ( Chapter 13 ) :

Note It would be neater to use a System::DateTim e object to represent
the date of birth, but you can't have pointers to managed types as members
of a __gc class.

So I mean ... It could be an error ... I hope :)

BR,
Michele

"Russell Hind" <no****@no-where.com> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
Are you sure it doesnt' mean they can't be members of non __gc classes?
If you want one as a member of a non-gc class, you use

gcroot<MangedOb ject_c*> m_ManagedPointe r;

In a __gc class, you just store them as normal pointers.

Cheers

Russell

m wrote:
Hi,
I'm reading Microsoft Visual C++ .NET Step by Step, Version 2003 and I found a sentence it says :
"you can't have pointers to managed types as members of a __gc class.".

Why ?
Thanks,
Michele

Nov 17 '05 #3
m wrote:
Hi,
I'm just cutting and paste the exact text from the ebook ( Chapter 13 ) :

Note It would be neater to use a System::DateTim e object to
represent the date of birth, but you can't have pointers to managed types
as members of a __gc class.

So I mean ... It could be an error ... I hope :)


This is an error. I don't have enough context to figure out what the author
was trying to convey.

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #4

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

Similar topics

3
2210
by: mirek | last post by:
Hi, I've got problem building managed class library to wrap unmanaged code. I created managed class library using standard patten: #include "../Unmanaged/Class1.h" //Class1 unmanaged namespace ManagedWrappers { public __gc MClass1
3
4332
by: ricky_casson | last post by:
I'm attempting to create a managed C++ class from some an already existing application that I have however some of the classes allow private access via the 'friend' keyword and i've heard that this presents a problem when creating managed code. Does anyone know how i could get around this? Is it possible to still create managed code without having to make the classes managed? Moreover, what i'm trying to do is make the methods of an API,...
1
1602
by: Bern McCarty | last post by:
I am using MEC++ in VC 7.1. I had a method on a __gc object that looked like this: __property System::UInt32 get_MyProperty(void) { System::Byte __pin * pinBytes = &m_byteArray; // entire array is now pinned NativeStruct const __nogc* nativeStructP = reinterpret_cast<NativeStruct const __nogc*>(pinBytes);
7
1503
by: Steve Marsden | last post by:
Hi As a C programmer just starting to look at Managed C++, I was shocked to find that you cannot declare a managed type globally so that for example in a partiuclar module you can declare some data globally so that all functions in that module can see it to save passing it about as parameters. How do you achieve the same thing with Managed C++ managed data. Thanks
2
923
by: Peteroid | last post by:
I'm creating managed classes in an managed application, and believe I've seen the following generate a compile error: __gc class Parent_Class {} ; __gc class Child_Class : public Parent_Class {} ; __gc class Other_Class { public: void Method_1( Parent_Class** pc_ptr_ptr ) {}
3
1803
by: WithPit | last post by:
I am trying to create an managed wrapper but have some problems with it by using abstract classes. In my unmanaged library code i had the following three classes with the following hierarchy Referenced (class) Object (abstract class, inheriting from referenced) Node (class, inheriting from object)
3
2213
by: Hexar Anderson | last post by:
I have two questions: a) From documentation located at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcManagedExtensionsSpec_7_7.asp, it says, "Pinning a sub-object defined in a managed object has the effect of pinning the entire object. For example, if any element of an array is pinned, then the whole array is also pinned. There are no extensions to the language for declaring a pinned array. To pin an...
11
1820
by: Peter Oliphant | last post by:
Is there any plan to support templates with managed code in the (near) future? For instance, VS.NET 2005... : )
17
2397
by: Peter Oliphant | last post by:
In the 'old days', we could create a pointer to an instance of a variable like so: int i = 58 ; int* i_ptr = &i ; int j = *i_ptr ; // j = 58 Now, in /clr how do we do the same? That is, if I replace '*' with '^' what do I replace '&' with to generate a 'pointer' (is 'x^' called a 'reference' per chance?) to the instance? That is:
0
8444
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.