Check if an object is an instance of a given class or of a subclass of it

pharo, smalltalk

Solution

To test whether anObject is instance of aClass:

(anObject isMemberOf: aClass)

To test whether it is an instance of aClass or one of it subclasses:

(anObject isKindOf: aClass)

Problem

Is there an easy way to do this in Smalltalk? I'm 80% sure that there is some method but can't find it anywhere. I know that I can use ``` (instance class = SomeClass) ifTrue: ``` And I know that I can use `superclass` etc... but I hope that there is something built in :)

Original source