Imagine I have 3 functions
FunctionA, FunctionB, and FunctionC.
Ok, this functions are stored into a h.file (I would not want to use header and implem)
And... I dont want to create any class for this functions
I want to do something like when you use the string library. Just you have to inlcude <string> and later write std::the_string_functions.
Maybe it is a stupid question...., but I'd want to write my functions in a way they be 'inserted' into the classes which use them . (inline ?).
Thanks.
The std:: syntax has nothing to do with classes. It's a namespace.
I don't see what you could get out of writing a function then "referencing" it or something in a class. Just put the function in the class. If you need to use the same code multiple times for different classes, it probably shouldn't be in any one of those classes unless they are related somehow.
Uh... you can inline a function... but that's an optimization that could potentially improve runtime speed... I am not really sure if that's what you're after.
All that making a function inline means is that every time their is a call to the function the compiler replaces the function call with the actual body of the function (and changes up the code a bit so that there aren't errors). As for your question, perhaps I'm wrong here but are you trying to create friend functions so that you have a global function that you can as you put it "insert" into any class when you want too? If so you just have to define the function globally and then in the class declaration write something like