From:
Operating system:
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:extend Spl-class and override a methode
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 bug report at http://bugs.php.net/bug.php?id=53656&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53656&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53656&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53656&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53656&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53656&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53656&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53656&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53656&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53656&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53656&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53656&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53656&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53656&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53656&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53656&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53656&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53656&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53656&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53656&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53656&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53656&r=mysqlcfg