I have two classes: Action
and MyAction
. The latter is declared as:
class MyAction extends Action {/* some methods here */}
All I need is method in the Action
class (only in it, because there will be a lot of inherited classes, and I don’t want to implement this method in all of them), which will return classname from a static call. Here is what I’m talking about:
Class Action {
function n(){/* something */}
}
And when I call it:
MyAction::n(); // it should return "MyAction"
But each declaration in the parent class has access only to the parent class __CLASS__
variable, which has the value “Action”.
Is there any possible way to do this?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…