The first calls the copy constructor, with a temporary object as a parameter - MyClass()
creates a temporary one.
The second calls the default constructor.
In fact, they are in most cases optimized for the same code, but what is the semantic difference.
As Negal noted, the case is slightly different from POD types; when "MyClass" is POD, the second fragment will not initialize the mc
value, while the first will.
source share