As I learn C++, I've been keeping an Excel workbook to allow a summary of various aspects all in one worksheet. One of my worksheets is called "Methods," and I have some questions about the way I'm now structuring this. As background: I've been learning Java this fall and also want to understand structural similarities or differences between built-in methods in C++ and Java.
In Java for sure, and I think in C++, there seem to be 3 kinds of built-in methods: constructors (example in C++: valarray<dataType>(), etc.), class instance methods, and class (?) static methods.
Class instance methods in C++ are ones with prototypes like:
void ignore(); for the class istream or
void append(char * c) for the string class
When you use them, they require a calling object (str.append("name")).
Where I feel somewhat unsure is with what I'm calling static methods. I'm just not sure whether one should use that term in C++, but if not, then I don't know what to call them.
Examples in C++ would be methods like
int strlen(char * c); or
void strcpy(char * c1, char * c2);
In Java, examples would be something like
int parseInteger(String s);
But one big difference is that in Java, you then use the class name when you call the function (e.g., Integer.parseInteger("12")), whereas in C++ all you need to use is std:: as scope resolution operator (?).
Anyhow, methods like strlen() or strcpy() are defined in header files, in this case <cstring>, but I'm guessing that the mechanics of the definition are somewhat different than the way in which Java just makes them static methods of some class.
So, what would you call the method TYPE of these methods (that don't require a calling object) as opposed to the methods that do (where I don't see much problem calling those "instance methods" in C++, just as I've done in Java for methods requiring a calling object)?
Or is the way in which this kind of method in C++ is defined in some library sufficiently similar to the definitions within classes in Java to warrant using the term "static methods" in C++, too?