Hello I come from Diploma student Java background.
I would like to know if this is typically how i would set up the get and set member functions in C++
virtual double getX();
virtual void setX(double &newX);
double* Spritable::getX(){return &x;}
void Spritable::setX(double &newX){x = newX;}
and then would I retrieve the values stored at those memory addresses pointed to, by de-referencing
somthing like this ?
p.getTexture().loadFromFile(activeLevelStructuresImages[0], sf::IntRect(*p.getX(), *p.getY(), *p.getWidth(), *p.getHeight()));
Or return references such as this ?
virtual double& getX();
virtual void setX(double &newX);
double& Spritable::getX(){return x;}
void Spritable::setX(double &newX){x = newX;}
if this is so, Yes I think I do understand the textbook logic behind these operations, such as pointers and References after reading "Jumping into C++" a first time. I just would like to be sure if this is how its done. The last thing I wont to do is learn bad habits or incorrect operations.
Thanks Please let me know.