A
Alex
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
}
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
}