Marcus Boerger wrote:

> Hello vivi,
> 
> Wednesday, February 4, 2004, 5:19:40 PM, you wrote:
> 
>> Hello at all,
>> ok my problem in a nutshell: i need multiple inheritance! is there a
>> solution to fake this functionallity in php5?
> 
>> i have the following problem:
>> the goal is to implement my own DomXML implementation based on the
>> existing DomNode, DomDocument, Dom... Classes.
> 
>> thus, i implement my classes as follows:
> 
>> class MyNode extends DomNode {}                 // that isn't the problem
>> class MyDocument extends DomDocument {}         // would be fine, but...
> 
>> this would be an easy solution,  but there is a logical problem:
>> if i extend the DomNode (with the methods in MyNode) then -i think-
>> MyDocument should have those extended methods, too.
>> so i could write:
> 
>> class MyDocument extends MyNode {}              // problem
> 
>> but now i'm missing all the nice methods of DomDocument!!
>> multiple inheritance would solve this problem:
> 
>> class MyDocument extends MyNode,DomDocument {}  // not possible
> 
>> by the way: i will get into trouble with all Dom-Classes:
>> class MyElement extends MyNode,DomElement {}
>> class MyAttribute ...
> 
>> Hope you'll understand me?
>> Is there a way to solve this problem?
>> I'm thinking about the new __call() method implemented as follows:
> 
>> class MyDocument extends MyNode {
>>         function __call($method, $params) {     // fake solution
>>                 ...
>>                 eval("DomDocument::$method($paramsString);");
>>         }
>> }
> 
>> but with a fake solution like this i wouldn't get all methods with
>> get_class_methods() and that wouldn't be that nice:)
> 
>> Can Interfaces help me?
> 
>> Thanks for your efforts..
> 
> At least interfaces would force you to implement the same set of
> additional functions in each derived class. However interfaces cannot have
> bodys and hence you need to provide the code for each derived class
> separatley; with the ability to make mistakes or real errors.
> 
> interface extended_dom {
>   function myFunction();
> }
> 
> 
> class MyNode extends DomNode implements extended_dom {}
> class MyDocument extends DomDocument implements extended_dom {}
> 
> But this is a question for [EMAIL PROTECTED]
> 
> Best regards,
>  Marcus                            mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to