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

Please give me a pointer

P: n/a
Hi,
I see some codings like this but I don't know C++. I would
appreciated if you can shed me a light. Just point me the term for me
to look for.

a_class & a_class::operator=( const a_class & an_argument )
{
/* Bla Bla Bla */
return *this;
}
So what is this in C++ ?
Thanks in advance.
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Wong wrote:

Hi,
I see some codings like this but I don't know C++. I would
appreciated if you can shed me a light. Just point me the term for me
to look for.

a_class & a_class::operator=( const a_class & an_argument )
{
/* Bla Bla Bla */
return *this;
}

So what is this in C++ ?
Thanks in advance.


It is a 'copy assignment operator' or often
simply called an 'assignment operator'.

You should find information on that in every
C++ book with those keywords.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #2

P: n/a

"Wong" <ta*********@yahoo.com> schrieb im Newsbeitrag
news:50**************************@posting.google.c om...
Hi,
I see some codings like this but I don't know C++. I would
appreciated if you can shed me a light. Just point me the term for
me
to look for.

a_class & a_class::operator=( const a_class & an_argument )
{
/* Bla Bla Bla */
return *this;
}
So what is this in C++ ?


that's the function that get's called when you write:
a_class a, b;

a = b; // this line

where an_argument will be 'b', and *this will be 'a'.

HTH,
-Gernot
Jul 23 '05 #3

P: n/a
"this" is a pointer to the class instance currently being acted on by
some class method.

In the example you wrote, "this" is a pointer to an instance of class
"a_class" being acted upon by the method "a_class::operator=(const
a_class&)".

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.