johnmerlino1 Posted July 30, 2014 Share Posted July 30, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/290186-does-interfaces-include-default-definitions/ Share on other sites More sharing options...
trq Posted July 30, 2014 Share Posted July 30, 2014 No interface do not include implementation. Quote Link to comment https://forums.phpfreaks.com/topic/290186-does-interfaces-include-default-definitions/#findComment-1486447 Share on other sites More sharing options...
Jacques1 Posted July 30, 2014 Share Posted July 30, 2014 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. 1 Quote Link to comment https://forums.phpfreaks.com/topic/290186-does-interfaces-include-default-definitions/#findComment-1486450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.