Sealed classes and methods: Difference between revisions
Content added Content deleted
(Added FreeBasic) |
(J) |
||
Line 63: | Line 63: | ||
Lisa is watching the movie... |
Lisa is watching the movie... |
||
Sorry, Fred, you are too young to watch the movie.</pre> |
Sorry, Fred, you are too young to watch the movie.</pre> |
||
=={{header|J}}== |
|||
No J compilers have been released (though some people have claimed to be working on such things). That said, J does provide a locked script mechanism which might be thought of as compiled code (which depends on libj). |
|||
J, by default, does not support sealed classes (nor methods). However, sealed classes could be implemented by altering J's <code>coinsert</code> (which implements inheritance) to omit sealed classes. |
|||
For example, we could say that a class which contained any implementation of <code>final</code> is a sealed class: |
|||
<syntaxhighlight lang=J>coinsert=: {{ |
|||
l=. (#~{{0>nc<'final__y'}}"0);: :: ] y |
|||
p=. ; (, 18!:2) @ < each l |
|||
p=. ~. (18!:2 coname''), p |
|||
(p /: p = <,'z') 18!:2 coname'' |
|||
}}</syntaxhighlight> |
|||
J does not provide a mechanism to seal individual methods. |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |