posted 24 years ago
A parent class and a child class can have static funcions with same signature and return type. This means static methods can be overridden. So if you call a static method of a class and the method is not in that class, it tries to find a funcion with the same signature up in the class hierarchy.
But there is a slight problem when you use objects to call static fucntions. Think of this situation. A static method amethod() in class A is overridden in sub class B. You create an object of B and assign it to an object variable of A. Now you call the static method using A.amethod(). It picks up the amethod() of the parent, not of the child. If amethod() were non static,
it would have picked up the amethod() of B. The reason is
static methods are resolved at compilation and compiler honours the type of object variable.