Re: "pointers" in /clr
- From: "Nishant Sivakumar" <nish@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 15 Nov 2005 15:12:53 -0500
Hey Peter
Just want to add that ref classes also don't get a default assignment
operator.
--
Regards,
Nish [VC++ MVP]
"Peter Oliphant" <poliphant@xxxxxxxxxxxxxxxx> wrote in message
news:etNzUuh6FHA.2552@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Holger,
>
> In fact, the reason I asked was because I needed to create a copy
> constructor and I couldn't without knowing these syntax 'equivalences' to
> 'pointer' and 'contents of'... : )
>
> That is, I didn't know this is the form of a copy constructor for a ref
> class:
>
> ref class refClass
> {
> refClass( refClass% other ) {}
> } ;
>
>
> [==P==]
>
> "Holger Grund" <hg@xxxxxxxxxxxxxxx> wrote in message
> news:eNdNfbg6FHA.2576@xxxxxxxxxxxxxxxxxxxxxxx
>> "Peter Oliphant" <poliphant@xxxxxxxxxxxxxxxx> wrote
>>
>>> ref class myClass() {...} ;
>>>
>>> myClass i ;
>>> myClass^ i_ptr = &i ; // error, use what instead of '&'?
>> myClass^ i_ptr = %i;
>>
>>> myClass j = *i_ptr ; // error (i think), do what instead?
>>>
>> That's fine, so long as a copy ctor is defined. C++/CLI
>> does _not_ automatically define copy ctors for ref classes
>> * sigh *.
>>
>> If you want
>> the equivalent to a C++ reference (int%) you can write
>> myClass% j = *i_ptr;
>>
>> -hg
>>
>
>
.
- References:
- "pointers" in /clr
- From: Peter Oliphant
- Re: "pointers" in /clr
- From: Holger Grund
- Re: "pointers" in /clr
- From: Peter Oliphant
- "pointers" in /clr
- Prev by Date: Re: "pointers" in /clr
- Next by Date: Re: "pointers" in /clr
- Previous by thread: Re: "pointers" in /clr
- Next by thread: enums, 2005, and the debugger
- Index(es):
Relevant Pages
|
Loading