Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Image.cs #481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Image.cs #481

wants to merge 1 commit into from

Commits on Apr 14, 2021

  1. Update Image.cs

    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!
    CSBVision committed Apr 14, 2021
    Configuration menu
    Copy the full SHA
    c62cced View commit details
    Browse the repository at this point in the history