🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators oclIsKindOf
Created by Alexandra on 2017-08-13 · Last edited by Colline.ssali on 2026-02-27.

oclIsKindOf( typespec : Class ) : Boolean

The oclIsKindOf(T) operator checks whether an object is of a given type or any of its subtypes. It is mainly used in models with inheritance to safely test an object’s runtime type.

Syntax:

object.oclIsKindOf(TypeName)

Returns true if:

  • the object is exactly of TypeName, or
  • the object is a subclass of TypeName

Otherwise, it returns false.

Examples:

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