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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.