I am kinda relearning C++ after quite a long break, but I want to understand something about constructors.
Since following your tutorials I have been putting the code in the constructor like this.
Code: Select all
Missile::Missile()
:x(400 ),
y( 580 ),
Fired ( false),
Velocity ( 5 ),
Explode ( false ),
radius (0)
{
}
Code: Select all
Missile::Missile()
{
int Explode= 10;
int radius =5;
}
My programs ued to run ok, but I would need to call the constructor to iniaialise variables.
Of course I used to keep my functions and classes together before as well.
Asimov