PHP5 interfaces?

From: Date: Tue, 23 Sep 2003 00:27:33 +0000
Subject: PHP5 interfaces?
Groups: php.general 
Request: Send a blank email to php-general+get-163530@lists.php.net to get a copy of this message
Wondering if maybe someone famililar with php5 can respond to this. I am reading about PHP5 and it's interface support, and i have a concern. The purpose of interfaces is to handle multiple inheritance in a fashion that resolves a number of conflicts that arise when performing true multiple inheritance, the most obvious conflict being two identical members being inherited from different classes. What appears to be missing, and correct me if I'm wrong, is the ability to address this issue in PHP5. A (rather poor) Example: interface BoardMember { function position(); // used to set board position of board member } interface Employee { function position(); // used to set job title of employee } class BusyBoardMember implements Employee, BoardMember { function position(); // what does this function do? ambiguous unless I am missing something } In Visual Basic, for instance, this is handled using the "implements" keyword, so the function definitions within BusyBoardMember would look like: function position() implements Employee.position() function position() implements BoardMember.position() Then when you do something like function operatesOnEmployee(Employee $e) { $e->position("CEO") } or function operatesOnBoardMember(BoardMember $b) { $b->position("Chairman") } The right thing can happen, as the compiler/parser knows which position() you're referring to in each case. Hopefully this is the right list to be posting this, and hopefully I'm completely wrong and have missed something while reading about PHP5 :) -Javier

« previous php.general (#163530) next »