How can I enforce constants in sub classes?
For example:
Class A implements B
{
}
Class B implements I
{
}
interface I
{
const bb = 'lr';
public function aa();
}
Above code ensures class A
& B
Must have aa()
, but is there any way I can ensure class A
& B
must have a constant bb
?
class A must "extend" (not "implement") B, since B is a class, not an interface.
class B must implement function aa (because you're implementing an interface that implicitly needs all of its functions to be implemented);
Other than that, both A and B have their bb const defined and can be accessed with A::bb and B::bb