This question already has an answer here:
I have a function of type
virtual void foo(bla, bla, bla, std::shared_ptr<LoggerInterface> logger) = 0;
And I want to pass a default parameter with NULL pointer, something like:
virtual void foo(bla, bla, bla, std::shared_ptr<LoggerInterface> logger = NULL) = 0;
So that in implementation, if logger is NULL
I do nothing with it, otherwise I use the logger.
I've tried to look for a solution but cannot find..
Aucun commentaire:
Enregistrer un commentaire