Skip to content

Call methods in derived class  #20

Description

@uselessgoddess

Use static_cast to resolve this problem

Delegate(std::shared_ptr<Class> object, ReturnType(Class:: *member)(Args...))
: Delegate(std::make_shared<MemberMethod<Class>>(std::move(object), member)) { }

struct base
{
    void foo() { std::cout << "foo"; }
};

struct derived : public base {};

auto object = std::make_shared<derived>();
auto delegate = Platform::Delegates::Delegate((std::shared_ptr<base>)object, &derived::foo);
delegate();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions