Extends operator
The extends operator is used in type expressions to check whether one type extends another type. It is very similar to instanceof, except that the left operand is a type, and not a value.
It is primarily used in generics and templates, where different behaviour may be necessary for certain types.
Example
The following example creates a generic function, and logs messages depending on the generic type.
Non-stack types
When dealing with non-stack types (i.e. heap types or custom allocator types), the pointer type must be the same on both operands of the extends operator. If there is a mismatch, then the extends operator will always return false.
Extended classes
Like the instanceof operator, the extends operator returns true if the left operand type is the right operand, or if the left operand extends the right operand, via class inheritance. If this behaviour is undesirable, the "==" equality operator should be used instead.
Checking if some type does not extend another type
Unlike in many other C-like languages, the precedence of the extends operator is greater than that of the logical not "!" operator, which means that to invert the result, no brackets are required. This is the same as for instanceof.