|
Problem:
You want to declare that a class is abstract; that is, that any attempt to instantiate the class directly (as opposed to one of it's subclasses) should result in an immediate exception. Solution:
Declare the class using the
Discussion: Abstract classes are classes that are intended to be used as base classes for others to inherit from, but that shouldn't be directly instantiated themselves (typically because they aren't fully functional without the behaviors added by subclasses.) In Perl6, this is accomplished using the Just because a class does not have a constructor method does not imply that a class is abstract. Perl6 does not require constructors to exist (it can assume null-operationed constructors.) Note that abstractness, as a property, does not "inherit" downward: a subclass of a class is not automatically abstract, because that's almost certainly not what you want. All classes are assumed to be non-abstract (e.g. concrete) unless they are specifically declared with the The
|