Connecting Tech Pros Worldwide Help | Site Map

java or PHP 5.0 question about interfaces

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:32 AM
lawrence
Guest
 
Posts: n/a
Default java or PHP 5.0 question about interfaces

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, 12:32 AM
Fabian Wleklinski
Guest
 
Posts: n/a
Default 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, 12:32 AM
lawrence
Guest
 
Posts: n/a
Default 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?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.