Operator & and * at function prototipe in class
        Posted  
        
            by Puyover
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Puyover
        
        
        
        Published on 2010-06-17T21:37:03Z
        Indexed on 
            2010/06/17
            21:43 UTC
        
        
        Read the original article
        Hit count: 170
        
c++
I'm having a problem with a class like this:
class Sprite {
    ...
        bool checkCollision(Sprite &spr);
    ...
};
So, if I have that clase, I can do this:
ball.checkCollision(bar1);
But if I change the class to this:
class Sprite {
    ...
        bool checkCollision(Sprite* spr);
    ...
};
I have to do this:
ball.checkCollision(&bar1);
So, what's the difference?? It's better a way instead other?
Thank you.
© Stack Overflow or respective owner