"this"

Mar 9, 2014 at 6:24pm
Am I correct in saying this? I'm still trying to wrap my head around "this" pointers... Thanks in advance!

"this" keyword is a type of pointer and when using "this" you need to use the arrow member selection operator to point to a function or variable within the class because "this" is a pointer and it stores as it's variable the address of the current object working with once the object is created.

(*this).A is called dereferencing a pointer, it's a pointer that takes the address of the current object working with once the object is created and calls whatever variable or function using the dot separator, explicitly calling a variable or function.

Calling a standard variable i.e cout << A << endl; in main or a class just assumes you are working with said variable in whatever location applicable.
Mar 9, 2014 at 7:11pm
*edit*
Last edited on Mar 9, 2014 at 8:01pm
Mar 9, 2014 at 7:27pm
What is your question?
Mar 9, 2014 at 7:57pm
Here is example I asked about, might help:

ghttp://www.cplusplus.com/doc/tutorial/templates/
Mar 9, 2014 at 8:10pm
...Still waiting for a helpful response :L
Mar 9, 2014 at 8:19pm
ALEXCX2PLUS wrote:
Am I correct in saying this?

Yes
Mar 9, 2014 at 8:23pm
That's more like it, cheers man.
Topic archived. No new replies allowed.