I have constructor A(){}
Situation: There is only assignment and not memory allocation for member variable inside constructor.
In this situation, Is it recommended to use ~A()=default
? or Should I go for ~A(){}
?
Asked
Active
Viewed 91 times
0

Mayur
- 2,583
- 16
- 28
-
3Even better (if you don't need to declare it `virtual`) would be to not declare the destructor at all. See the Rule Of Zero. – aschepler Jan 05 '21 at 14:02
-
@nathanoliver I don't agree with the dupes. This core issue with the question is not about the `=default`, but about the need for a destructor. Which isn't needed. The dupe should be regarding the Rule of Zero, e.g. [this one](https://stackoverflow.com/a/4172724) – JHBonarius Jan 05 '21 at 14:05
-
@JHBonarius You're right that no destructor is preferred, but my interpretation of the question is that it is specifically asking about the difference between the two. – François Andrieux Jan 05 '21 at 14:22