Quote:Original post by Magmai Kai HolmlorQuote:Original post by load_bitmap_file
EDIT: I just remembered that you can't say "this" in the constructor's initializer list! Still nifty though.
You can, you just have to be careful not to actually use it.
You may use this in the initializer list. The behavior of it is perfectly well defined. Since the initializer list is defined to be in the scope of the constructor, this can be used to reference to the object under construction safely. (12.6.2 - 7)
The only problems that could be encountered is when access a base class that has not been constructed yet. For instance, calling a virtual function when the object it applies is the object under construction, the function called is the one defined in the class under construction or one of it's bases, but not a function overriding it in a derived class from the constructor. (12.7 - 3)