void myClass<temp_Type>::myFunction(myClass<temp_Type>* &firstClass, myClass<temp_Type>* secondClass)
{
     
}

[call]

myFunction(*this, &secondClass);

I think I am fundamentally challenged on the "this" qualifier. I want to pass a pointer to the current object(ie the object I am calling the function from), but am stuck trying to pass the "this". Are there any other methods to go about something such as this?

If you want to pass POINTER to current object, then it is simply this , and not *this

this is a pointer, *this dereferences the pointer. So if you want to pass a pointer just don't use the asterisk. myFunction(this, &copyClass); That doesn't mean it will solve your problem, but that's how to pass pointers.

That looks like a recursive function call, I doubt you even need to pass this pointer because the compiler will do that anyway.

Since I need to change the actual object itself, I would need to do something along the lines of &this

Unsure of if its legal or not, going to try it now. Thanks for the quick replies.

Nah, &this is illegal, compiler fusses at me :D Time for a new approach ::cracks fingers::

The special pointer this has type Class*const (not Class*) so you can't pass this as an argument to myFunction.

It seems the myfunction member has a slightly unusual signature with the 1st parameter of type "a reference to a pointer to myClass<temp_Type>". Can you explain what do you want to do with the 1st parameter of this member function?

this is certainly a bugger. I ended up having to re-route what I was trying to accomplish. I do appreciate the help.

>I ended up having to re-route what I was trying to accomplish.
What were you trying to accomplish? The way I'm reading your problem, you're confused about what this is. A pointer to the current object is always available from a non-static member function; you don't have to pass it explicitly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.