Jump to content

Does interfaces include default definitions?


johnmerlino1

Recommended Posts

Do interfaces in PHP include default methods, which are available in Java 7 and 8. Default methods allow you to add default functionality in the interface itself. So when a class implements it, it can use the default definition from the interface. This is in contrast to an abstract method which has no method body.

Link to comment
Share on other sites

Why are you so obsessed with silly comparisons of programming languages, John? You seem to spend your entire time picking random features from random languages and trying to find an equivalent in PHP.

 

Of course you're free to to that (we all have some strange hobby), but I fail to see the relevance or usefulness. You can philosophize all day long about why PHP's strpos() returns false when C's strpos() returns -1, or why PHP doesn't have the latest fancy features of Java. But I fear you won't learn PHP one bit from doing that.

 

PHP is neither Java or C. It's PHP. The question is: What do you want to do? Then we can tell you how it's done in PHP.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.