Firstly, it is more efficient to define values ββin the initialization list. If you do not, if you do not have a smart compiler, the values ββwill be initialized by default and assigned. For some types, this is not very efficient (although not in the class that you have there).
As to why he decided to do it this way for this one class, this is unclear. I can only assume that he could possibly catch a possible ejection from the new in a situation of lack of memory - although even there he could make new(nothrow) for what would probably be more efficient and understandable.
What he could try to do is not to drown out the order of initialization requirements for C ++ class members that are initialized in the order in which they are declared in the class definition, and not in the order in which you specified them in the initialization constructor list. This can be a real pain, although most compilers now warn you if you do this (and also allow you to change this warning to an error). In this case, it would be possible that win was declared before header , and in this case, executing win(header) in the initialization list would set win to header value, before header received initialization. Although even there I still had an initialized header in the initialization list and only put win initialization in a code block.
What really annoys me is the use of parameter lists (void). This is C-ism, and it looks ugly. Especially for default constructors and destructors.
source share