ID:               30090
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mikarento at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows 2000
 PHP Version:      5.0.0
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The object you pass is a ImplClass which has a write method. Your
problem here is that PHP does only dynamic binding and resolving at
runtime unlike for example C++.


Previous Comments:
------------------------------------------------------------------------

[2004-09-15 07:53:23] mikarento at hotmail dot com

Description:
------------
Method who's parameter is object of particular interface should not
invoke other method of its interface. 

Reproduce code:
---------------
interface Printable{
 public function print();
}

interface Writeable{
 public function write($text);
}

class ImplClass implements Printable, Writeable{
 public function print(){
  return 'hallo'
 }
 public function write($text){
  //...
  echo 'written';
 }
}

class Printer {
 public static function printIt(Printable p){
  p->write('wow');
 }
}

$a = new ImplClass();
Printer::printIt($a);

// the result is 'written'

Expected result:
----------------
error: Printable object doesn't have 'write' method 

Actual result:
--------------
written


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


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

Reply via email to