Connecting Tech Pros Worldwide Help | Site Map

java or PHP 5.0 question about interfaces

  #1  
Old July 17th, 2005, 01:32 AM
lawrence
Guest
 
Posts: n/a
Do interfaces enforce how many arguments can be passed to a method? If
two classes inherit from the same interface, can one have
formatThisText($text) and another have formatThisText($text,
$formatter) ??? I'm assuming the answer is yes, interfaces do enforce
the number of arguments.
  #2  
Old July 17th, 2005, 01:32 AM
Fabian Wleklinski
Guest
 
Posts: n/a

re: java or PHP 5.0 question about interfaces


Hi Lawrence,
[color=blue]
> I'm assuming the answer is yes, interfaces do enforce
> the number of arguments.[/color]

Concerning JAVA you are right. Interface enforce the number
of parameters, their types, the type of the returned value
and even the method's visibility.

Greetings From Frankfurt/Germany,

Fabian Wleklinski


  #3  
Old July 17th, 2005, 01:32 AM
lawrence
Guest
 
Posts: n/a

re: java or PHP 5.0 question about interfaces


lkrubner@geocities.com (lawrence) wrote in message news:<da7e68e8.0310140020.ff5df7e@posting.google.c om>...[color=blue]
> Do interfaces enforce how many arguments can be passed to a method? If
> two classes inherit from the same interface, can one have
> formatThisText($text) and another have formatThisText($text,
> $formatter) ??? I'm assuming the answer is yes, interfaces do enforce
> the number of arguments.[/color]

Thank you for the reply. That is what I would expect in Java. Does
anyone know the answer for PHP 5.0? Or where that information is
documented? I noticed a bunch of very interesting articles here
(though they didn't answer my question):

http://www.zend.com/zend/php5/index.php

PHP is truly become a script version of Java, with a nearly complete
imitation of Java's object features, minus strict typing.

Still, I'm wondering about interface enforcement in PHP 5.0 and can't
find an answer.

Another question I have is can an argument passed to a method have a
default value in one object but a different default value, or none, in
another object if both inherit from the same interface?
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advantages and disadvantages of PHP? Jonathan Sachs answers 21 February 20th, 2008 09:45 PM
a pre-beginner's question: what is the pros and cons of .net, compared to ++ lester answers 44 November 22nd, 2005 05:49 PM
a pre-beginner's question: what is the pros and cons of .net, compared to ++ lester answers 44 July 21st, 2005 09:44 PM
PHP or COLDFUSION English Teacher answers 60 July 17th, 2005 02:39 AM