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

java - SSE Emitter : Manage timeouts and complete() -

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

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -