|
Problem:
You want your class to inherit from a literal value. Solution:
Just do it:
Discussion: In the second example above, we have declared a class, This can be an extremely powerful way to quickly make classes that are treated as literal (constant) values in almost all situations, but that have extra methods or transformations that the original value didn't. When inheriting from a literal value, you are inheriting from an instance of whatever builtin type that literal value represents. See Section 6 to learn what builtin types exist in perl, and how to subclass those builtin types.
|