Php polymorphism - Call a parent function in polymorphed child function?

I think you're looking to use the parent keyword.

I think you're looking to use the parent keyword: class Invitation extends Event{ public function getLang($lang){ parent::getLang($lang); $sql = "SELECT * FROM invitation WHERE EventID =" . $this->EventID . " AND Lang = " .

$lang; } }.

That worked. I have another problem also related to polymorphism.

You have to use parent class Invitation extends Event{ public function getLang($lang){ parent::getLang($lang); .... } } Event::getLang($lang); is infact trying to call getLang statically. See these links: Scope Resolution Operator (::) Parent.

The method is not static, so instead of calling the static method Event::getLang(), you need to call parents method parent::getlang($lang); Update: I meant, with Event::getLang() you usually call a static method on a class, that may or may not be extended. Where parent::method() calls always the inherited method and keeps the scope (class or static) of the calling method, Classname::method() always tries to call a static method on the specific class.

You can actually use parent:: in a static parent/child class setup – Adam Feb 22 at 12:01 Right. I meant, with Event::getLang() you call a static method on an class, that may a parent class, or a completely different one. Of course you can call inherited static methods this way too, but self::getLang() is prefered here.

– KingCrunch Feb 22 at 12:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions