Re: Passing const objects as arguments to function or return types
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Tue, 28 Aug 2007 12:42:07 -0500
"Subodh" <subodh.borker@xxxxxxxxx> wrote in message
news:1188322141.463099.213360@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,
In C++ we could pass a constant reference to a function so that the
target function could not modify the objects passed
eg. const classA & dummmyfunction(const classB)
similar thing was valid for objects passed with pointer to constant
objects
In C++/CLI is there any way for imitating this, I want to pass
arguments to and return value from my member function as a constant
objects.
Sadly no, the compiler throws an error as soon as you try to declare const
member functions, so passing handles to const is pretty useless: you can't
even read properties.
currently i am passing a handle to the object to client (consumer)
function which then can easily modify the object received
I had one more doubt about C++/CLI
In C++/CLI Handles are similar(may be not not equivalent) to that for C
++ pointers
Is there any operator that is equivalent to C++ References (&) in C++/
CLI
The tracking reference (%) is the version of the C++ reference that supports
garbage collection
any help will be appreciated
Thanks and Regards,
Subodh
.
- Follow-Ups:
- References:
- Prev by Date: Passing const objects as arguments to function or return types
- Next by Date: Re: Passing const objects as arguments to function or return types
- Previous by thread: Passing const objects as arguments to function or return types
- Next by thread: Re: Passing const objects as arguments to function or return types
- Index(es):
Relevant Pages
|