I have a class containing type variables of this type.
class Field { union DATATYPE { int intValue; double doubleValue; char* charValue; MyClass* MyClassValue; } Value; ~Field() { delete[] Value.charValue; delete Value.MyClassValue; } }
This destructor gives an error. Since some objects do not have an initialized charValue, an attempt to delete it caused an error.
source share