Skip to content

[Feature Request] Make Wire library methods virtual #31

Open
@simonnilsson

Description

@simonnilsson

I suggest making the public methods of the TwoWire class virtual in order to allow polymorphism when subclassing it.

Use case: Have another library that utilizes the Wire library and takes a refrence to a TwoWire instance in constructor. Want to use it on pins without hardware I2C (or other reason for not wanting to use the standard Wire implementation). So I want to pass another class instance that inherits from TwoWire and implements the same methods (but uses software I2C). This does not work with current implementation because of early binding (the base class functions will be called instead of the ones in subclass).

Moved from: arduino/Arduino#8734

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