so i wrote this program, i am not able to get how can static void showID a static function access int companyID a normal variable, can someone please explain.
Ok, so you seem to need a more explicit statement: Static methods inside a class can only access static class variables or variables declared inside the static method. The variable companyID is declared inside the static method and is therefore available for use inside this static method.
ok thx then what is the use of static functions ? is the use of static function only being able to access the function without declaring an object like Dealer::showID();
I thinks that their use also has to do with the fact that they are static: they are shared between different instances of this class instead of having each object its own function.
Imagine them as being class specific instead of object specific like most functions