Search code examples
c++destructorprimitive

C++ - Running destructor on a primitive?


What happens when you run a destructor on a primitive? Can't find the answer anywhere.


Solution

  • Destructors are part of class definitions. If by "primitive type" you mean fundamental types, then the question doesn't make sense, since fundamental types aren't class types, and there's nothing that can "run".

    There's a grammatical construction called a pseudo-destructor, but it isn't a destructor and doesn't run.