Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We would like to suggest an additional constructor for the Image class to improve its usability in inheritance chains.
Deriving a child class from Image is possible, however all inherited functions that return Image instances return base class object (Image instances) only.
For example, DerivedImage.Clone() will return only an Image, but not a DerivedImage, and the temporary Image instance has to be converted into a DerivedImage.
This requires an explicit instantiation of DerivedImage.
Currently, the latter cannot be performed without copying the data from the temporary source image (i.e. the return value of the inherited member function like Clone()) into the new one.
Here, the additional protected Image constructor allows to move the data from the temporary source image into the newly created one.
Alternatively, this functionality could also be implemented in method that swaps the member variables between two Image instances, but it requires access to private data members as welll such that it also requires an extension of your sources.
Therefore, we found this modification to be the best suited one for this functionality and would appreciate if you accept our proposed modifications.
Thanks in advance!