I have parent class Color and children, ColorRGBA and ColorHSLA. In class Color I want to use a static functions from these children, but I got error "Class 'Color' not found." Here is the same problem http://forums.codeguru.com/showthread.php?t=469995 but class Color; doesn't seem to work in PHP.
Color.php:
include_once 'ColorRGBA.php';
include_once 'ColorHSLA.php';
class Color{
public static function isValid(&$tokens, $i) {
return ColorRGBA::isValid($tokens, $i) || ColorHSLA::isValid($tokens, $i);
}
}
ColorHLSA.php and similarly ColorRGBA.php
include_once 'Color.php';
class ColorRGBA extends Color {
public static function isValid(&$t, &$i) {
...
}
}
How should I rebuild my class hierarchy or include directives? Or is there any other option how to make my code work?