Req #53656 [Opn->Bgs]: extend Spl-class and override a methode
| From: | aharvey@php.net | Date: | Thu, 06 Jan 2011 01:49:51 +0000 |
| Subject: | Req #53656 [Opn->Bgs]: extend Spl-class and override a methode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157642@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53656&edit=1
ID: 53656
Updated by: aharvey@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