1

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

Bryan
  • 2,951
  • 11
  • 59
  • 101
  • 1
    What exactly do you mean? What would that even look like? – Oliver Charlesworth Oct 22 '14 at 22:34
  • 2
    The best you can hope for is a pseudo destructor call, which does nothing. – chris Oct 22 '14 at 22:34
  • My professor raised the question in class, but didn't answer it and I wasn't able to figure it out on my own. Oh well. – Bryan Oct 22 '14 at 22:39
  • 1
    Clearly a "How would you..." needs to be answerable before proceeding to "What happens when you...". If that was the verbiage the instructor used my immediate in-class response would have been "show me how you would do that and I'll work out what it does." Something tells me you were stuck on the former rather than the latter. – WhozCraig Oct 22 '14 at 22:44

1 Answers1

2

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.

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084