| Share this post! | Vote this! |
|
While you are programming you would want to use some class members independently
of any object of that class. Normally a class member is accessed with
the help of the object of that class. However, it is possible to create
class members that can be used by itself. To create such a member, the
keyword static has to precede its declaration.
When a class member is declared as static, it can be accessed before any object of that class is created and without reference to any object. Both methods and variable can be declared as static. The best example to understand is our main() which is declared static. Its is static because it must be called before any object exist. more...
When a class member is declared as static, it can be accessed before any object of that class is created and without reference to any object. Both methods and variable can be declared as static. The best example to understand is our main() which is declared static. Its is static because it must be called before any object exist. more...




0 comments:
Post a Comment