RE: [PHP] What is the practical use of "abstract" and "interface"?

From: Date: Wed, 16 Apr 2008 15:57:40 +0000
Subject: RE: [PHP] What is the practical use of "abstract" and "interface"?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-273090@lists.php.net to get a copy of this message
[snip] > What about encapsulation? Interfaces have nothing to do with encapsulation for the smple reason that I can have encapsulation without using interfaces. > Also, there is an advantage to > interfaces that has not been mentioned yet, the fact that a > class can implement multiple interfaces (polymorphism). Interfaces have nothing to do with polymorphism for the smple reason that I can have polymorphism without using interfaces. > And > yes, I know that I can extend by inheritance to create > polymorphism too, but what is the most efficient method? It > depends on the application. > > Like anything else interfaces are a tool and there may be > multiple tools that can accomplish the same job (i.e. table > saw, band saw, hand saw). Pick the one that is right for you. You are still missing the fundamental point. There is absolutely nothing I can do WITH interfaces that I cannot do WITHOUT them, therefore they are redundant. [/snip] I never said that they were not redundant, I acknowledged that they were. I you can do without them or choose to do without them then that totally up to you.

« previous php.general (#273090) next »