hey guys am still learning c++ but am just kind of confused about move constructors and copy constructors.
first i have a simple function that set a value to an object
#include <iostream>
#include "item.hpp"
#include "player.hpp"
player giveHealth(player user, int value) {
user.set_health(value);
return user;
}
int main() {
player a;
player b(a);
a = giveHealth(a, 100);
return 0;
}
as you see i didnt add && on the return type but it still call's the move constructor at the end of the givehealth() function?