Inheritance: extends A2
Example #1
0
 static function MethodInheritance()
 {
     $_y = new A3();
     Timing::Start("Declared instance method direct invocation");
     for ($i = 0; $i < self::LOOP_COUNT; $i++) {
         $_x = $_y->f3();
     }
     Timing::Stop();
     $_y = new A3();
     Timing::Start("Inherited instance method direct invocation");
     for ($i = 0; $i < self::LOOP_COUNT; $i++) {
         $_x = $_y->f2();
     }
     Timing::Stop();
     $_y = new A3();
     Timing::Start("Inherited (two levels) instance method direct invocation");
     for ($i = 0; $i < self::LOOP_COUNT; $i++) {
         $_x = $_y->f1();
     }
     Timing::Stop();
 }
 function testCloneParent()
 {
     /** @noinspection PhpExpressionResultUnusedInspection */
     $a1 = new A3();
     $a2 = clone $a1;
     $this->assertNotEquals(spl_object_hash($a1->getB()), spl_object_hash($a2->getB()));
 }