Calling a method of an object of a child.
Results 1 to 3 of 3

Thread: Calling a method of an object of a child.

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    174

    Calling a method of an object of a child.

    I have two classes, Abba and Baka.

    Baka extends Abba. Abba contains a list of arrays (empty on instantiation).

    Baka has a method which adds to these arrays. Each array added has:

    String: Identifier (just a name)
    Object: Reference
    String: Name of Function in the above object.

    I'd like to be able to call that object's function from Abba by doing something like the following:

    PHP Code:
    //Assume $caldera is one of those
    //arrays I mentioned.
    //$args is an array of arguments.

    call_user_func_array(array(&$this->$caldera[1], $caldera[2]), $args); 
    Since $caldera is an object contained in the child, I should be able to reference it by &$this-> ... but I get the following error:


    Warning: call_user_func_array(): First argumented is expected to be a valid callback, 'Array' was given in C:\sambar62\docs\Foo\Foo.php on line 145


    Any ideas?
    I\'m back.

  2. #2
    Senior Member
    Join Date
    Mar 2003
    Posts
    452
    post the whole code, it'll help with debugging.


    thanks,
    PuReWebDev
    Like this post? Visit PuRe\'s Information Technology Community. We\'ve also got some kick ass Technology Forums. Shop for books and dvds on LiveWebShop.com

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    174
    Got it working, thanks. You can see the demo at http://mygripe.net/ao_guys.php . Only works in Firefox at the moment.
    I\'m back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •