How do you define a global function in C++?

I would like a function that is not a member of a class and is accessible from any class.

I assume I would have to #include the header file where the function is declared, but I don’t know where to define such a global function.

Are there good reasons against having such a function in the first place?

Leave a Comment