cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
what is the purpose of using 'const int
what is the purpose of using 'const int &' as formal argument?
Apr 30, 2009 at 11:09am UTC
nanger
(71)
thx
Apr 30, 2009 at 11:49am UTC
Bazzy
(6281)
const
int
&
doesn't make much sense but
const
Aclass &
is used in order not to copy an object of 'Aclass' which can take much longer time than passing a const reference
Apr 30, 2009 at 5:33pm UTC
writetonsharma
(1461)
Addition:
const can be used by compiler to optimize you code.
May 1, 2009 at 7:04pm UTC
Hammurabi
(399)
Passing an int by reference and promising not to modify it is a strange operation indeed.
Topic archived. No new replies allowed.