There are multiple ways of initializing an object in c++. There are two examples below, ent1 and ent2. I'm wondering what the difference is, and is one of them more 'correct' or preferred over another?
class Entity {
public:
int h;
Entity(int health) : h(health) { }
}
Entity ent1(10);
Entity ent2 = Entity(10);