|
Problem:
You want to create a class method: a method that may be called using the class name explicitly, and that does not require an instance to be created in order for the method to be used. Solution:
Declare the method using the
Discussion: A class method is a generic term for a method of a class may be called without actually creating an instance of the class. You may call class methods within an object just as you would call any other method, but when the method is called, it will use the class of the object, and instance information will be unavailable. When creating methods in perl5, the first argument to a method was either a class name or an object instance, depending on how the method had been called. To mimic the effect of class methods, code like this was often used:
For perl6 class methods, the step of converting an object to a class name is done automatically.
Issue: Desperately needs a better property name. Issue:
Or, we just use
|