If I have a class structure with a value that can either be true or false, that doesn't change, currently implemented as variables would it be better to change them to constants, such as:
class Parent {
const BOOL_CONST = false;
...
}
class SomeChild extends Parent {
const BOOL_CONST = true;
...
}
Later I have an object which may be of any type in that class hierarchy, either the parent or one of its children, and some of the children may, like 'SomeChild' have overloaded the value to be true.
Is there some way I can access the constant without knowing the class? In other words can I do something like:
$object->BOOL_CONST
Or would it be better to leave these values as variables, even though they really shouldn't change?
UPDATE
I've reworded my question above to better express what I was attempting to ask.