Edit report at http://bugs.php.net/bug.php?id=53656&edit=1

 ID:                 53656
 Updated by:         ahar...@php.net
 Reported by:        coola at arcor dot de
 Summary:            extend Spl-class and override a methode
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
 Package:            *General Issues
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Bugs in PECL packages, such as SPL_Types, should be reported on the

PECL bug tracker instead of this one. In this case, you can request

the feature at http://pecl.php.net/bugs/report.php?package=SPL_Types


Previous Comments:
------------------------------------------------------------------------
[2011-01-05 18:59:16] coola at arcor dot de

Description:
------------
Hi,



i would like to do something like that:



<?php

   class A extends SplInt // extends SplInt

   {

      protected $x;

      protected $y;

      public function __construct($x,$y)

      {

         $this->x = $x;

         $this->y = $y;

      }

      public function splIntMethode($other, $operator) // override
SplInt-Methode

      {

         if($operator != '+')

            throw new Exception();

         if(!($other instanceof A))

            throw new Exception();



         return new A($x + $other->x, $y + $other->y);

      }

   }

   $a0 = new A(1,2);

   $a1 = new A(3,4); // $a1 is the '$other'-Objekt at methode
splIntMethode

   $a2 = $a0 + $a1;  // $operator +

?>



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53656&edit=1

Reply via email to