Is it safe to use the “this” pointer in an initialization list?

Yes. It’s safe to use this pointer in initialization-list as long as it’s not being used to access uninitialized members or virtual functions, directly or indirectly, as the object is not yet fully constructed. The object child can store the this pointer of Parent for later use!

Leave a Comment