OCLOperators oclIsKindOf
No edit summary
No edit summary
Line 1: Line 1:
This is to if a class is a subclass or a the class itself and not unrelated
=== oclIsKindOf( typespec : Class ) : Boolean ===
Returns true if the type of ''self'' corresponds to the type or supertype of typespec, false otherwise. This operation allows users to check the class hierarchy of ''self'' much like would an instanceof Java.
{| class="wikitable"
!Expression
!Result
|-
|anEmployee.oclIsKindOf(Employee)
|true
|-
|anEmployee.oclIsKindOf(Person)
|true
|-
|aCat.oclIsKindOf(Person)
|false
|}
[[Category:OCLOperators]]
[[Category:OCLOperators]]

Revision as of 21:54, 15 October 2019

This page was created by Alexandra on 2017-08-13. Last edited by Stephanie@mdriven.net on 2025-02-12.

oclIsKindOf( typespec : Class ) : Boolean

Returns true if the type of self corresponds to the type or supertype of typespec, false otherwise. This operation allows users to check the class hierarchy of self much like would an instanceof Java.

Expression Result
anEmployee.oclIsKindOf(Employee) true
anEmployee.oclIsKindOf(Person) true
aCat.oclIsKindOf(Person) false
MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments