By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,159 Members | 913 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,159 IT Pros & Developers. It's quick & easy.

beginner's question regarding pass parameter

P: n/a
pass by value is:
declare with:
function(class a)
call with:
function(a)
and a is COPIED

pass by reference is
declare with:
function(class *a)
called with:
function(&a);
and a pointer of a is COPIED, but only one copy of a in memory

pass by (what's the third one???) is:
declare with:
function(class& a);
called with
function(a);
and a pointer is passed, only one copy in memory...

IS THIS CORRECT?
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Matthew Monopole" <ma*******@hotmail.com> wrote in message
news:de*****************@newsread2.prod.itd.earthl ink.net...
pass by value is:
declare with:
function(class a)
call with:
function(a)
and a is COPIED
Right.
pass by reference is
declare with:
function(class *a)
Actually, this is passing by /pointer/. myclass* is a
pointer-to-myclass.
called with:
function(&a);
and a pointer of a is COPIED, but only one copy of a in memory
Right.
pass by (what's the third one???) is:
declare with:
function(class& a);
This would then be passing by /reference/. myclass& is a
reference-to-myclass.
called with
function(a);
and a pointer is passed, only one copy in memory...


Right.

hth
--
jb

(replace y with x if you want to reply by e-mail)
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.