|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-06 02:49 UTC] aharvey@php.net
-Status: Open
+Status: Bogus
[2011-01-06 02:49 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 23:00:01 2025 UTC |
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 + ?>