In the first syntax the variable is initalised as it constucted. In the second the variable is initialised after it is constructed which is illegal since the variable is const.Originally Posted by AH_Tze
In the first syntax the variable is initalised as it constucted. In the second the variable is initialised after it is constructed which is illegal since the variable is const.Originally Posted by AH_Tze
Ah. I'd seen something similiar using user-defined types, but I'd never seen a primitive data type being initialized that way. Very clever.
Thanks all, and I am once again in Preludes debt.
>but I'd never seen a primitive data type being initialized that way. Very clever.
I would recommend getting into the habit of using the initialization list rather than assignment in your constructors. It's always legal, and often more efficient. Of course, it could be impractical if you have a huge number of members to initialize, but that's really a sign of bad design IMO.
My best code is written with the delete key.