What is the use of a static function in c++?
you can use it to access only other static members of that class.
you can access instance members of a class using static methods, without creating object for that class.
you can access only static variables from a static method.
there is no static method concept in c++
you can use it to access only other static members of that class. Generally this is when if the static variable is private and want to expose it to outside world, then use a public static method to read that value.
Back To Top