Calling function of a Class in a Class....

What is the proper sytax for calling a function of a member variable for a class?

EXAMPLE CODE:

class Foo
{
function test()
{
return "OK";
}
}

class Bar
{
var $foo = new Foo

function test()
{
// This doesn't work.
return $this->foo->test();
}
}

I can't subclass because I have multiple class's as member variables and PHP does not support multiple inheritence.

Thanks

- jack -

Comments

  • Don't know this for sure, but I guess there is no way to do what you want to do. I guess you have to wait for PHP with zend 2 - there class-Functions will get better.

    best regards,

    sebastian mohrenstecher
    executive secretary
    net::allies

    www.net-allies.de
    info@net-allies.de

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion