if I wanted to do for example this

class MyClass{
     float x,y;
     void SomeFunction()
};
void MyClass::SomeFunction(){
     MyClass A = this;//????
}

How would I do that? I have virtually no experience with pointers so please help me out.
I basically want to make the new class I am creating within the class equal to the parent class or what ever you would call it. I tried puting * and & in different places but always got an error.

Re: A quick question about the "this" pointer 80 80
class Myclass{
      float x,y;
      void some_function();
      };
      
void Myclass::some_function(){
     Myclass* a = this;
     }
Re: A quick question about the "this" pointer 80 80

Ok that worked but I got one more problem. I need to return the class afterwords. How do I return a pointer?

Re: A quick question about the "this" pointer 80 80

nvm I figured it out, thank you for your help though.

Be a part of the DaniWeb community

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