Is it possible in PHP 7 ?
Question: I have Parent class Foo. Bar class inherit from Foo and Bar2 class inherit from Foo and i want to inherit bar3 class from Bar and Bar2. Is it Possible ?
this is possible in java (Diamond Inheritance) Java Example
how can i achieve this in PHP 7?
<?php
class Foo
{
public function printItem()
{
echo 'Foo: ';
}
}
class Bar extends Foo
{
public function printItem()
{
echo 'Bar: ';
}
}
class Bar2 extends FOO
{
public function printItem()
{
echo 'Bar2';
}
}
//class Bar3 extends Bar & Bar2 i need like this
$foo = new Foo();
$bar = new Bar();
$bar2=new Bar2();
$foo->printItem();
$bar->printItem();
$bar2->printItem();
?>