In C++ can constructor and destructor be inline functions?

Defining the body of the constructor INSIDE the class has the same effect of placing the function OUTSIDE the class with the “inline” keyword.

In both cases it’s a hint to the compiler. An “inline” function doesn’t necessarily mean the function will be inlined. That depends on the complexity of the function and other rules.

Leave a Comment