By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,824 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,824 IT Pros & Developers. It's quick & easy.

java or PHP 5.0 question about interfaces

P: 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.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Lawrence,
I'm assuming the answer is yes, interfaces do enforce
the number of arguments.


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
Jul 17 '05 #2

P: n/a
lk******@geocities.com (lawrence) wrote in message news:<da*************************@posting.google.c om>...
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.


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?
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.