Skip to content

The multiple inheritance problem #9

@ArielLorenzo-Luaces

Description

@ArielLorenzo-Luaces

I'm having an issue where I need to implement a class that can be used as a texture and can be sent to SPImage and such.
Normally I would subclass SPTexture and override whatever I need to implement my new functionality.
However in this case I also need to subclass another class from a closed source library.
But without multiple inheritance this can prove challenging

One solution I came up with is to change sparrow so that instead of SPTexture being used directly by other classes such as SPImage, there could be a texture interface for SPImage to interact with.
Then all I would need to do is subclass that other closed source library and then implement sparrow's SPImage's texture interface. Followed by an implementation of all the interfaces methods.
This way I can completely bypass SPTexture and can still get SPImages to show without any hassle.
In the end, SPImage couldn't care less what class it's interacting with as long as the class is providing the texture methods that SPImage needs.

I'm really just writing this to see what other people think. That's why I didn't make a pull request.
The changes:
https://github.com/arielsw/Sparrow-Framework/commits/90c7330be4310779395f0f230a4db0f15e341e28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions