Mar 1, 2000
Adding Object-Oriented Functionality to a POD Type
Sometimes, legacy code that contains Plain Old Data (POD) types (i.e., dumb structs that don't have any member functions) can use an object-oriented "face lift", e.g., adding a constructor or member functions. Instead of adding the new functionality directly into the POD struct, it's better to derive a new class from it and add the new object-oriented functionalitymember functions, constructor and destructorto the newly-derived class. Leaving the struct intact will ensure binary compatibility with other code components that still use the original struct.