Say I have a base object, CacheObject:
abstract class CacheObject {
protected static $handler = null;
public static function setCacheHandler($handler) {
static::$handler = $handler;
}
public static function getCacheHandler($handler) {
return static::$handler;
}
}
class A extends CacheObject {
}
class B extends CacheObject {
}
A::setCacheHandler('test');
var_dump(B::getCacheHandler());
B will give me "test", which I believe is because class A does not have it's own defined property $handler... so it is using the inherited one, shared by class B. Is this accurate?
Is there any way I can in fact have them set separately, without needing to declare $handler within every object?