Sealed classes and methods: Difference between revisions

Content added Content deleted
(Update C++ entry)
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 383: Line 383:


3. Using the 'is' operator (i.e. a ''is'' C) to detect the type of 'a' wouldn't work here as this would return 'true' if 'a' were either a 'C' object or an object of a subclass of 'C'. It is possible to spoof the 'is' operator by overriding its normal behavior, though this is definitely not recommended!
3. Using the 'is' operator (i.e. a ''is'' C) to detect the type of 'a' wouldn't work here as this would return 'true' if 'a' were either a 'C' object or an object of a subclass of 'C'. It is possible to spoof the 'is' operator by overriding its normal behavior, though this is definitely not recommended!
<syntaxhighlight lang="ecmascript">class Parent {
<syntaxhighlight lang="wren">class Parent {
construct new(name, age) {
construct new(name, age) {
_name = name
_name = name