java - How to know, which child are called static parent method? -
i have next classes:
abstract public class parent{ static public void logrequestor(){ //string requestor = // how requestor? //log.e("requestor is: " + requestor); } } class childa extends parent{ } class childb extends parent{ }
somewhere have next lines:
childa.logrequestor(); childb.logrequestor(); childa.logrequestor();
how know, child called static parent method no params in function logrequestor
? want have next logs:
requestor childa requestor childb requestor childa
that not possible, statics defined in class not in instance therefore statics cannot e.g. inherited und therefore cannot used polymorphism.
see answer more details: why doesn't java allow overriding of static methods?
Comments
Post a Comment