Jump to content


Photo

Class variables as functions


  • Please log in to reply
No replies to this topic

#1 Nove

Nove
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 15 September 2006 - 08:41 PM

Here's a mockup I've tried to be able to set functions of a class when the object is constructed.  I'm not really sure how to go about this, but from what I've made you should get the idea that I want to set f and g to functions.  How can I do this?

function clarence() {
	echo "clarence!";
}

function marla() {
	echo "marla!";
}

class functioner {
	function __construct(&$v, &$b) {
		$this->f = $v();
		$this->g = $b();
	}


}

$c = new functioner(clarence, marla);
$c->t = "5";
echo $c->t;
$c->f();
$c->g();





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users