|
Posted by boris on 12/18/07 15:37
Hi. If somebody can help out with this design question, thank you very
much. Suppose I have a global constant, like an images directory. This
constant will be referenced from multiple classes. How do I define
this constant only once while using OOP? I could define the constant
on one of the classes and then reference it with ClassName::const from
the other classes, but this ties the constants to one class
arbitrarily. In Java you can define constants in an interface, and any
class implementing the interface automatically inherits the constants.
Is this possible in PHP5? I looked around the Web, but couldn't find
an example to that effect. Thank you!
~ Boris
Navigation:
[Reply to this message]
|