Abstract type: Difference between revisions

Content added Content deleted
Line 113: Line 113:
def !valid?(object) nil
def !valid?(object) nil


tag AbstractStack some-object ; always fails
tag AbstractStack some-object ;# always fails</lang>
*** Error: class AbstractStack validator error for some-object ...</lang>


However this is not much use if we want to use an abstract class to define an interface. Here is a quasi-abstract class which can be used to tag objects if they conform to the class's membership expectations. In this case it wants two methods, !enstack and !destack:
However this is not much use if we want to use an abstract class to define an interface. Here is a quasi-abstract class which can be used to tag objects if they conform to the class's membership expectations. In this case it wants two methods, !enstack and !destack: