I have a parent class (I don't want to edit it) which contains some methods
class Message {
private function createNewMessageSimpleOrAlternativeBody() {
...some code here...
}
private function createNewMessageRelatedBody($oPart){
...some code here...
}
private function createNewMessageMixedBody($oPart){
...some code here...
}
public function ToPart($bWithoutBcc = false)
{
$oPart = $this->createNewMessageSimpleOrAlternativeBody();
$oPart = $this->createNewMessageRelatedBody($oPart);
$oPart = $this->createNewMessageMixedBody($oPart);
$oPart = $this->setDefaultHeaders($oPart, $bWithoutBcc);
return $oPart;
}
}
then I have another class which extends above and where I want to add my code
class MessageEx extends Message {
private function createNewMessageSimpleOrAlternativeBody() {
...some code here + additional code...
}
private function createNewMessageRelatedBody($oPart){
...some code here + additional code...
}
private function createNewMessageMixedBody($oPart){
...some code here + additional code...
}
public function ToPart($bWithoutBcc = false)
{
$oPart = $this->createNewMessageSimpleOrAlternativeBody();
$oPart = $this->createNewMessageRelatedBody($oPart);
$oPart = $this->createNewMessageMixedBody($oPart);
$oPart = $this->setDefaultHeaders($oPart, $bWithoutBcc);
return $oPart;
}
}
but in an extended class when I try to use public function ToPart()
it tells me that any method used there was declared in a parent class not in this subclass, which I have expected as each of them is private and can be accessed only within the class vis $this
. In that case edited functions are not executing my code as those are not called even when I have declared them (methods in a subclass) as final
or protected
What I have missed?