[Cs3] virtual destructors and object slicing

Mikhail Nesterenko mikhail at cs.kent.edu
Fri Oct 20 21:07:41 EDT 2023


CS3 students,

I talked about virtual destructors in class. I mentioned it is related
to object slicing. It turns out, not necessarily. Actually, the
behavior of trying to delete of a derived class through base class
pointer is _undefined_. See this discussion in stackoverflow:

   https://stackoverflow.com/questions/461203/when-to-use-virtual-destructors

Object slicing is explained here:

  https://en.wikipedia.org/wiki/Object_slicing

Thanks,
-- 
Mikhail


More information about the cs3 mailing list