Class file with override methode

Hey guys, I try to create a effect class for a LED strip. Shortly, when I call this funktion, I want to create something init which can be different when I call it. Here a example:
In class

class LedEffect {
void call();
}

When I create that effect:

LedEffect effect;
effect.setOnAction({
bla bla bla bla bla bla
}

When I use the file:

effect.action();

In Java I would search for override methods, but I searched the internet with no result, so I'm here XD

I have a example for that as well, so in the ESP8266WebServer library you can call your server object and than

 .on("url"), HTTP_GET, [](){
bla bla bla
});

and I want some kind of that thing in my class as well.

The “{bla bla bla}” is called a “lambda expression” or “lambda”. It’s an anonymous function (function with no name). You can use it like any other function pointer.

I think you want your object to have a ‘callback function’. To do that you would have a function pointer you call in your .action() method:

public:
    void setOnAction(void(*func)()) {CallbackPointer = func;};
    void action() {if (CallbackPointer) (*CallbackPointer)();};
private:
    void (*CallbackFunction)() = NULL;

Yeah I heard of lamba :3 thank you very much ^^ but I killed both my esps so I can't test it now XD