Can anybody help me to clear this thing out?
I use Add Member Function Winzard to add a function to class. If I uncheck Inline box, there is only function prototype like below appear on classname.h file:
CBox operator+(const CBox& aBox) ;
and on the classname.cpp file, there is the full function:
CBox CBox::operator+(const CBox& aBox) {
return CBox();
}
However, if I check the Inline box, the full function appear on classname.h file like below:
CBox operator+(const CBox& aBox)
{
return CBox();
}
AND nothing appear on the classname.cpp.
I am not sure whether it is because of the Inline check or not?
Anyway, is this a big difference between using Inline and not Inline function that I need to worry?
Another thing is that if I check Inline box, the function is CBox operator+……
But if I uncheck Inline box, the function is CBox Cbox::operator+. What is the different meaning?
Thank you very much.
When you select in-line, it means that the code will be dropped in at the location that is being called. For this reason, the entire implementation needs to be in the header file. If you don’t select inline, it will be placed in the cpp file, as one (and only one) copy should be compiled and linked.
Inlining code may make your application larger, but is considered faster has there is no overhead of a procedural call. Use inlining if the implementation is small.