Smalltalk: Checking if a method belongs to a class (or its inheritance hierarchy) -


is there smalltalk message answer boolean value if given method (example: passed #amethod) belongs given class (or hierarchy)?

i want —

(self containsmethod:#amethod) iffalse:[...blah blah]. 

obviously, containsmethod: placeholder message hope exists. oh, , self's superclass in example object. thanks!

you can use #respondsto:

1 respondsto: #+. 

and there class-side counter part canunderstand:

1 class canunderstand: #+. integer canunderstand: #+. 

Comments