View Single Post
Old 11-17-2007, 03:38 PM   #7 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Why dont you just inherit an abstract class?

PHP Code:
<?
abstract class a
{
    public function 
func($param)
    {
        echo 
"$param";
    }
}

class 
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
Village Idiot is offline  
Reply With Quote