Go Down

Topic: Array of strings – compiling error [Solved] (Read 276 times) previous topic - next topic

gfvalvo

If it's static, then it's a class function. That means there is only one version of it for the entire class (just like a static data member). If it's not static, then each instance of the class has its own copy (again, just like a non-static data member).

If non-static, then it can return results specific to the instance to which it belongs. If static, it can't. In fact, you don't even need an instance of the class to call a static class function.

Look at the example .ino files I posted. For a non-static member function, you call it like so:
Code: [Select]

// Call from outside the class (only if public):
result = instanceName.functionName(arguments);

// Call from within the class (public or priviate):
result = functionName(arguments);


For a static class function, you call it like so:
Code: [Select]

// Call from outside the class (only if public):
result = className::functionName(arguments);

// Call from within the class (public or priviate):
result = functionName(arguments);


guraknugen

Thanks for the information. I haven't touched C++ much, I'm a little more used to C, even if I'm far from good at it. Seems like my little project will be an interesting learning trip!  :)
Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ

Go Up