I know that declaring a function (normal function not a method inside a class) as inline is a good practice when the function definition is small for performance and it save
There are two options to offer to the compiler to make a class function inline:
(1) Defining a function in the declaration of the class (in a header file)
class Human {
public:
Human(const char* name);
Human();
// is implicit inline
void lookAt(const char* name) const {
std::cout << "I'm looking at " << name << std::endl;
}
private:
char _name[30];
};
(2) Using the inline keyword explicitly in the definition of the function (in a header file)
// is explicit inline
inline void lookAt(const char* name) const {
std::cout << "I'm looking at " << name << std::endl;
}