There is no difference. You are just declaring variables. You can also use int x {1};
Addition to the already said https://stackoverflow.com/questions/1051379/is-there-a-difference-between-copy-initialization-and-direct-initialization
actually in the book said = is copy assingment and () is direct! i tought with my self there is difference..
Copy assignment happens when you already have some value in that variable and reassign it, example: MyClass var; var = myClassFactory(); In this case it is different from just initialization: MyClass var = myClassFactory(); Your examples above were about initialization.
I think i got it... Thnx🌹
Обсуждают сегодня