CC_CALLBACK_1(Foo::bar, this) vs [this](A* a){ bar(a); }

When should I use the former one? If I override bar in a subclass, it will still call the previous version.

1 Like

You can use either. If you have a method used in more than one place it might be better as a class method and use CC_CALLBACK_1, if you have one-off code then a lambda is often easier and better since the code is localized where it’s used.

We usually use lambdas 90% of the time.

Learn and use one or both for now and you can explore best practices and optimizations later on.

what a great question!

I too, like lambdas for their containment. But if I am going to call the same code more than once, method it is.