c++ - static method or non-static method using static field -


i have static const std::vector<sometype> field in class. have 2 private methods uses field (searching methods). not use members of class. should define static or normal methods?

what should prefer? advantages/disadvantages?

methods reference static members should defined static. lets access these methods without creating instance of class, , access them static context (e.g. non-member function).

the exception rule when need make access member function defined virtual. in case have no option make function static, because static functions cannot override virtual functions.


Comments

Popular posts from this blog

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

python 2.7 - Lines in my code being skipped and I am not sure why -

python - multiprocessing pool with map -