I was told that
(i) Every member function defined in the class body is an automatic inline function.
(ii) Every member function defined outside of the class body, but in the head file should be declared as inline.
(iii) Every member function defined outside of the class body, and in the cpp file should NOT be declared as inline.
Which is true?
For eg.:
Is foo1 an inline function? Is it a must to declare foo2 as an inline function?Code://xxx.h Class C1{ public: C1(aa=1):a(aa){}; int foo1(){ return a;}; int foo2(); int foo3(); private: int a; }; inline C1::foo2(){ return 0; } //xxx.cpp C1::foo3(){ return 0; }
Can we declare foo3 as an inline function?