I'm new at C++ and I'm currently learning about constructors. Say I have a class Dog with a constructor:
class Dog{
Dog(){
std::cout << "Constructor called!
}
};
I know that in C++ there are different ways(if I'm not mistaken) we can create an object, for instance:
1- Dog dog;
2- Dog dog = Dog();
3- Dog *dog = new Dog;
4- Dog *dog = new Dog();
5- Dog dog();
But here is the thing: statements from 1 to 4 all call the constructor, but the statement number 5 doesn't and I can figure out why.
Do you have any idea why the fifth statement doesn't call the class constructor? Thanks.