Skip to content

Instantly share code, notes, and snippets.

View mjschutz's full-sized avatar
🏠
Working from home

Mauro Joel Schütz mjschutz

🏠
Working from home
View GitHub Profile
@mjschutz
mjschutz / WrapMethod.cpp
Created November 5, 2023 15:49
Wrap a Derived Class method to pass to a closed API call using templated function
#include <iostream>
using namespace std;
struct A {
// Use this to wrap method from a derived class
template <typename Class, void (Class::*method)()>
void makeCall() {
(dynamic_cast<Class*>(this)->*method)();
}