I am required to provide a solution to the following problem:
A class is published as a library and made available to the world. It is designed in a way which does not use the pimpl approach. Two new data members need to be defined in this class. How can these additional data members be added to the class without breaking the ABI? The solution should be a generic approach that can be used to avoid ABI breakages for any class designed, which does not use the pimpl approach.
My first solution was to create a new class which inherits from this previous class and then adding the 2 new members there. Then source code which require these 2 new data members can make use of this newly created class. However, my solution was marked incorrect. I was told that I must repurpose an existing data member for other purposes in a similar approach to pimpl. I did not understand what this really means, as I was not provided with any interfaces of this existing class.
What alternatives are there to pimpl which allow changes to existing classes without breaking the ABI?