11-17-2007, 03:38 PM
|
#7 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
Why dont you just inherit an abstract class?
PHP Code:
<? abstract class a { public function func($param) { echo "$param"; } }
class b extends a { public $variable; }
$instance = new b; $instance->variable = "hello there"; $instance->func($instance->variable); ?>
Class A cannot be called as an instance because it is abstract, therefore then only class that can use func() is B, or any class that extends A.
Note: You must have PHP5 to do this, php4 doesnt support abstraction if I recall
|
|
|
|