niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » C++
Please give me a pointer
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
Wong
*nix forums beginner


Joined: 25 Feb 2005
Posts: 6

PostPosted: Mon Feb 07, 2005 1:10 pm    Post subject: Please give me a pointer Reply with quote

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.
Back to top
Karl Heinz Buchegger
*nix forums Guru


Joined: 21 Feb 2005
Posts: 651

PostPosted: Mon Feb 07, 2005 1:14 pm    Post subject: Re: Please give me a pointer Reply with quote

Wong wrote:
Quote:

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
kbuchegg@gascad.at
Back to top
Gernot Frisch
*nix forums Guru Wannabe


Joined: 23 Feb 2005
Posts: 272

PostPosted: Mon Feb 07, 2005 1:17 pm    Post subject: Re: Please give me a pointer Reply with quote

"Wong" <tatto0_2000@yahoo.com> schrieb im Newsbeitrag
news:509bfe22.0502070610.3fb273de@posting.google.com...
Quote:
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
Back to top
kevin.hall@motioneng.com
*nix forums beginner


Joined: 04 Feb 2005
Posts: 18

PostPosted: Mon Feb 07, 2005 8:10 pm    Post subject: Re: Please give me a pointer Reply with quote

"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&)".
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 9:57 am | All times are GMT
navigation Forum index » Programming » C++
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Function Pointer Sikandar C 3 Fri Jul 21, 2006 1:23 pm
No new posts determine pointer to point to array or single item during... yancheng.cheok@gmail.com C++ 5 Fri Jul 21, 2006 1:17 am
No new posts Accessing structure elements using pointer math - padding... quantumred@gmail.com C 12 Wed Jul 19, 2006 3:11 am
No new posts passing a pointer to member function problem dice C++ 3 Tue Jul 18, 2006 9:17 am
No new posts error when rename pointer names ehabaziz2001@gmail.com C 3 Mon Jul 17, 2006 10:09 pm

Proliant Server Memory | Cheap mp3 players | Online Name | Debt Consolidation | Problem Mortgage
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1420s ][ Queries: 16 (0.0369s) ][ GZIP on - Debug on ]