When it comes to static function members, is it required to make a prototype of the function and define the function with the scope operator? or is it possible to define a static INLINE member in a class?
is it required to make a prototype of the function and define the function with the scope operator?
No.
or is it possible to define a static INLINE member in a class?
Yes.
Nothing is wrong with the function in the code you posted. The only error in the code that I see is that you are not instantiating your static "number_of_plants" member. If you do that it should work fine:
You should instantiate it once, just like you would define a method of the class once - for a static integer like this, you can actually just add it into the class definition: staticint number_of_plants = 0;
This works with any type in C++11.
For other types, the initialization (just like Disch wrote as a example, see line 18) would generally be in the source file. If you want to change it any other time, you can just assign to it normally, e.g.: Plants::number_of_plants = 123;
Always, unless you intend not to use it :D. You don't need to initialise it though if you just want the initial value to be zero.
int Plants::number_of_plants;
You can look at a static member variable as a global variable with class scope. For a "regular" global variable e.g. int number_of_plants;, definition and instantiation take place in the same line.