2007 Oct 26 6:54 AM
what is the purpose of a static constructor and can a static methos be overrrided.
2007 Oct 26 11:15 AM
Hi,
The purpose of static constructor is to initialise static attributes.
As the static method appears for a class you can not override a static method.
Reward points if useful,
Aleem.
2007 Oct 26 11:15 AM
Hi,
The purpose of static constructor is to initialise static attributes.
As the static method appears for a class you can not override a static method.
Reward points if useful,
Aleem.
2007 Oct 26 1:04 PM
HI Sandeep,
usually constructors are used to initialize variables.
Static Constructor is used to Initialize static variables.
The static methods are executed with higher priority without any instance ....
they cannot be overwritten.
for more info..
A static method can be called without prior instatiation of the class. This is the technical aspect. When do we define a method as static? If the method does not need to know any details of an instance then I would define this method as static. This is the semantic aspect.
Typical examples are utility methods, calculations, etc.
Example: class CL_ABAP_CONTAINER_UTILITIES
Its static methods convert either a string into a structured data type or vice versa. For this purpose the methods do not need any knowledge of any instances, the input is sufficient enough.