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.

class Myclass{
      float x,y;
      void some_function();
      };
      
void Myclass::some_function(){
     Myclass* a = this;
     }

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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.