When should I write the keyword 'static' before a non-member function?

后端 未结 3 953
一整个雨季
一整个雨季 2020-12-02 09:15

I\'ve recently seen a bit on SO about the static keyword before a function and I\'m wondering how to use it properly.

1) When should I

3条回答
  •  感情败类
    2020-12-02 09:59

    You should define non-member functions as static when they are only to be visible inside the code file they were declared in.

    This same question was asked on cplusplus.com

提交回复
热议问题