473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Please give me a pointer

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
3 1027
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

"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help...
18
by: free2cric | last post by:
Hi, I attanded an interview on C++ Question asked were and my answers to them.. 1. In a CPP program what does memory leak occure? -- i said.. In a constructor , the pointer variables were...
16
by: David Ford | last post by:
I have a macro that I use across the board for freeing ram. I'd like to clean up my code so I don't get these warnings. #define sfree(x) _internal_sfree((void **)&x) #define _internal_sfree(x)...
39
by: gtippery | last post by:
Newbie-ish questions - I've been away from C for a _long_ time. It seems to me that there ought to be easier (or at least shorter) ways to do what this does. It does compile & run for me (with...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: albert_reade | last post by:
Hello I was wondering if someone could please help me understand what I need to do in order to get this project to work. I just need some hints or a push in the right direction to get this to work,...
11
by: natman | last post by:
Hi i need to write a funcition called install, its takes as arguments 1- a vector 2-a number 3-a list called next_level so heres where it get kinda weird: next_level is a list comprising of...
3
by: vinod.bhavnani | last post by:
float (*ptr), *p; main() { float ****A = NULL; int cnt, cnt1, cnt2, cnt3;
9
by: incredible | last post by:
how to sort link list of string
5
by: weidongtom | last post by:
Hi, I tried to implement the Universal Machine as described in http://www.boundvariable.org/task.shtml, and I managed to get one implemented (After looking at what other's have done.) But when I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.