I am working on a project with a friend that does a lot of computation and we are using c++ for it. I havent used c++ in a while and he is suggesting some fixes. I hoped I could come here for a more in depth explanation and maybe could be linked to some more articles.
He says its more efficient instead of having this
Hand::Hand(Card one, Card two)
To have this
Hand::Hand(const Card &one, const Card &two)
Is this correct? What about passing a constant address rather than the object itself makes it more efficient? He mentioned passing a reference instead of making a copy. If I dont pass by address, will it construct a new card object as a copy of the one I've passed?
Also
Instead of
bool Hand::hasFourKind(Card board[])
Have this
bool Hand::hasFourKind(const Card *board)
This passes a pointer to the start of the array instead of making an array copy?