<?php
class A {
    public static function who() {
        echo __CLASS__;
    }
    public static function test() {
        static::who(); // Here comes Late Static Bindings
    }
}
class B extends A {
    public static function who() {
        echo __CLASS__;
    }
}
B::test(); // Outputs "B"
?>
I want to get an equivalent in Java...so something like
class A {
    public static void who(){
        System.out.println("A");
    };
    public static void test(){
        who(); //<<< How to implement a static:: thing here???
    }
}
class B extends A {
     public static void who(){
        System.out.println("B");
     };
     public static void main(String[] args){
        B.test(); // Outputs "A" but I want "B"
     }
}
I want the who() call inside A::test to resolve as in PHP 5.3 by calling B::who.
EDIT: I know there is no "standard way" of doing this in most popular languages. I'm looking for hacks and such. Also, is this possible in C/C++, or any other popular OOP language?
This is not for any real design on anything. I'm just being curious.
 
     
     
     
     
     
    