OCLOperators oclIsKindOf
(Adding message template to the top of the page)
(Replacing message template with parser tag)
 
Line 1: Line 1:
{{message|Write the content here to display this box}}
<message>Write the content here to display this box</message>
=== oclIsKindOf( typespec : Class ) : Boolean ===
=== oclIsKindOf( typespec : Class ) : Boolean ===
Returns true if the type of ''self'' corresponds to the type or supertype of typespec - otherwise, returns false. This operation allows users to check the class hierarchy of ''self'' much like they would an instance of Java.
Returns true if the type of ''self'' corresponds to the type or supertype of typespec - otherwise, returns false. This operation allows users to check the class hierarchy of ''self'' much like they would an instance of Java.

Latest revision as of 07:51, 17 June 2024

oclIsKindOf( typespec : Class ) : Boolean

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

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

To check if an object has the exact type and not only inherits a type use OCLOperators oclIsTypeOf

This page was edited 95 days ago on 06/17/2024. What links here