How do I use set_inst_override_by_type to an instance whose class has many children?

In reply to cgales:

I have updated the details and problem description. Do you see anything unusual in the code ?