Reply to Re: which language allows you to change an argument's value?

Your name:

Reply:


Posted by Scott Gifford on 10/01/07 17:28

Summercool <Summercoolness@gmail.com> writes:

> I wonder which language allows you to change an argument's value?

[...]

> What about Java and Perl?

Perl will let you change the value of a passed-in object directly.
Others have already answered about Java.

> is there any way to prevent a function from changing the argument's
> value?

Make a copy of the object, and pass in the copy.

Without making a copy, of the languages I know, C++ comes closest to
supporting an unmodifiable argument passed by reference. Using a
const reference or const pointer indicates that the reference won't be
changed, but even that can be subverted by the function's author with
casting.

-----Scott.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация