We know that the base class destructor is marked virtual for proper destruction of derived class instances as the base type pointers. Then what are the differences between the following derived class destructor practices?
- Simple destructor:
~Derived();
- Destructor with override:
~Derived() override;
- Default destructor with override:
~Derived() override = default;
- Virtual destructor:
virtual ~Derived() override = default;
Also is there a known best practice?
Aucun commentaire:
Enregistrer un commentaire