Static Methods and Properties:
•Static methods, also called class methods, are methods that are declared with the static keyword.
•Static methods, which are attached to a class rather than to an instance of a class.
•Static methods, are useful for encapsulating functionality that affects something other than the state of an individual instance.
•Static methods can be accessed only through a class and not through an instance of the class.
•We cannot use the keywords this or super within the body of a static method.
•[reason : Both the this reference and the super reference have meaning only within the context of an instance method.]
•Static properties are not inherited by subclasses. This means that static properties cannot be accessed through an instance of a subclass. A static property can be accessed only through the class object on which it is defined.
•Although static properties are not inherited, they are within the scope chain of the class that defines them and any subclass of that class.
No comments:
Post a Comment