July 15th, 2005, 12:57 AM
A extends B which calls A which calls B...
I'm working on a project, and I've hit a roadblock of sorts.
The language of choice here is PHP (4.4)
I have two classes, A and B. B extends A.
"A" has a method, let us call it "addFunc", that takes the names of functions (to be declared in the child) and adds them to an instance variable, funcList.
"B" is nothing but a collection of functions. In it's constructor, it calls addFunc(), passing it a bunch of function names. (e.g., addFunc("func1", "func2"...) )
"A" has another function which executes these functions by going:
Where $args is an array of arguments and $func_name is the string representation of a function from the funcList.
call_user_func_array(array(&this, $func_name), $args);
So take note, these functions are in the child...
I'm getting an error in there somewhere, and I have a feeling that may be it, but I'm not sure.
July 15th, 2005, 04:45 AM
"A and B. B extends A."? So the parent of a class is the child of the class its parent of? Are you sure there isnot another way to do this?
July 15th, 2005, 06:00 AM
Umm... not really sure what that means, but what I mean is I have Class A and Class B, but in reality, B extends A... so A is the parent, B is the child.