Finding a object in a HASH_TABLE using item feature on EIFFEL -
i having problem comparing 2 objects in hash_table
person class attributes such name, b-day, status of relationship, spouse name, spouse id. composed of attributes code:
list: hash_table[person, integer_64] put(id1, id2: integer_64) local p1, p2: person p1 := model.list.at(id) -- or p1 := model.list.search(id) p1 := model.list.found_item -- same error below end
error: source of assignment not compatible target.
the features used return "detachable g"
i think should doing "if attached" ensure item feature returns correct object type , assign? i'm not sure how cast object though.
the error triggered calling above feature
the reason need these functions work can sort easier
the features return detachable g
because possible no element found. therefore need use object tests, e.g.
if attached model.list [id1] p1 , attached model.list [id2] p2 ... -- use p1 , p2 end
Comments
Post a Comment