Different ways of initializing an object in c++
问题 I'm pretty sure this is a duplicate question, but I've been searching for a while and I didn't get any smarter. Imagine this class: class Entity { public: int x, y; Entity() : x(0), y(0) { } Entity(int x, int y) : x(x), y(y) { } } And here are multiple ways of initializing the class: Entity ent1; Entity ent2(); Entity ent3(1, 2); Entity ent4 = Entity(); Entity ent5 = Entity(2, 3); I also know that's it's possible make an object on the heap memory, but that's not a great mystery to me at this