Interpreting Code Assistance

Need help interpreting this code. I'm pretty new to c++ and am trying to figure out what this line of code is actually supposed to do. Here is the page that contains the code:
http://www.terathon.com/wiki/index.php/Defining_a_Custom_Controller

And i'm trying to figure out what this is line doing in particular:
SpinController(const SpinController& spinController);

I am also not entirely sure what is going on here:
1
2
3
SpinController();
SpinController(float rate);
~SpinController();

Is he just declaring two functions to use function overloading for the constructor?

As said i am new to c++ so i appreciate any help. The actual code is part of the c4 game engine. I'm a 3d artist attempting to bridge the gap to programming, so you may see me here quite a bit!
Last edited on
They are prototypes for some constructors and the destructor.
see http://www.cplusplus.com/doc/tutorial/classes/ ( scroll to Constructors and destructors )

SpinController(const SpinController& spinController) is the copy constructor
Last edited on
Thanks for the reply. After seeing that my last two questions were actually in the documentation i checked there first this time, but didn't find an answer (unless i missed it):

Controller *Replicate(void) const;

What is that line doing? Assuming Controller is a class, to me it looks like it is a constant function named Replicate that takes no arguments and returns type Controller (or more so returns an object of the controller class). But i am not sure what the * is doing there. I know the * can be for multiplication, a deference operator, or simply for declaring a pointer, but i am not sure if the code is doing any of those things.
Furthermore the functions definition syntax is a little confusing too:

1
2
3
4
Controller *SpinController::Replicate(void) const
{
    return (new SpinController(*this));
}


But i'm assuming that will make sense once i understand the function declaration/prototype above. I'm mainly used to programming in php in a procedural manner so i'm still wrapping my head around a lot of this class syntax.
1
2
3
4
Controller *SpinController::Replicate(void) const
{
    return (new SpinController(*this));
}
Member function returning a pointer to controller which take no arguments and doesn't modify the caller object

allocate a new SpinController copying the current one ( new here is calling the copy constructor ) and return the pointer returned from new 
Topic archived. No new replies allowed.