Class member function calls inside ctor and dtor

Johan Engelen j at j.nl
Sat Jan 27 16:41:35 UTC 2018


On Saturday, 27 January 2018 at 16:18:26 UTC, Thomas Mader wrote:
>
> Can't answer your question but have a little question.
> How is the behavior different to the situation in C++?

In C++, the dynamic type of an object changes during construction 
and destruction (e.g. base class ctor calls base class 
implementation of virtual functions).
Because of that, it may be confusing to call virtual functions in 
the ctor/dtor, and people advice against it. In D, the situation 
is much more clear (imo).

- Johan



More information about the Digitalmars-d mailing list