I'm trying to do something as
work (a_father: FATHER)
do
if a_father.conforms_to ({DEVELOPER}) then
a_father.code
else
a_father.change_job ({DEVELOPER})
end
end
the compilation works, but in my implementation @runtime it doesn't pass. What did I mistype?
I'd better use a built-in mechanism to check object type conformance:
if attached {DEVELOPER} a_father as dev then
dev.code
else
a_father.rest
end
And use the same approach in the precondition:
attached {RELATED_DB_ENTITY} a_relationship_entity
The object test does what you would like to: it checks that the type of the object attached to argument a_relationship_entity
conforms to type RELATED_DB_ENTITY
.