Although using =default for constructors is clear for me (i.e. forcing the compiler to create the default constructor while other ctors exist), I still cannot understand the difference between these two type of destructors:
- Those that use =default
- Those that are not defined explicitly and generated by compiler automatically.
The only thing that comes to my mind is that the group-1 destructors can be defined as virtual, but group-2 is always non-virtual. So, is that the only difference between them? Is there any scenarios that the compiler is not generating the destructor, but using =default forces the compiler to generate it?
p.s. I have checked lots of Qs in stackoverflow, but none of them answers my Q. Here are some relevant questions.
- Difference between =default and {} ctos/destructors
- Defaulting virtual destructors
- Difference between =default and empty dtrs
Aucun commentaire:
Enregistrer un commentaire