+ 2
Why static is used in defining a function
4 odpowiedzi
+ 2
if the function (method) is defined as a static it belongs to a class not to object.For calling this kind of methods you shoud not create an object.Acces specifier is class name not an object name.
+ 2
but be aware, in C and C++ has the static modificator different meaning;)Only for full explenation;)
+ 1
A static member function can be called even if no objects of the class exist and the static functions are accessed using only the class name and the scope resolution operator : A static member function can only access static data member, other static member functions and any other functions from outside the class.
0
how we write the accessing statement of a class name sum and static member function data??