I'm making use of an interface for a set of classes. I have a problem however because I wish for any visibility
to be allowed in the interface (That is: public
, protected
and private
).
I need the parent method to only be protected and I need the child method to be private, but I get the error saying
Fatal error: Access type for interface method Baz::qux() must be omitted in <the file with Baz/Bar>."
I tried specifying other visibility methods in the inteface Baz
and removing public
, but they all failed.
Is there a way I can do it via the interface? If not, then is there a way I can declare it abstract
, I tried that as well, but failed.
interface Baz
{
public function qux();
}
class Bar implements Baz
{
protected function qux()
{
//do foo
}
}
class Foo extends Bar implements Baz
{
private function qux()
{
parent::qux();
}
}