Hi Alex,
No, you can't this have been subject of debate before, if you don't want
your object to be change and you know for sure or donot know if the calling
method will modify it you will need to clone it before.
Take a look at this thread:
http://groups.google.com/groups?hl=e...%26scoring%3Dd
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alex" <a.*******@verizon.net> wrote in message
news:O0**************@TK2MSFTNGP11.phx.gbl...
When I pass a reference to a method by value, the reference argument to
the method is copied but still points to the original object, and that method
can modify the object. Can I apply const keyword to the argument to
prevent this?
f.e.,
instead of:
void Method(mytype obj)
{
// can modify obj
}
do:
void Method(const mytype obj)
{
// can't modify obj
}