http://qs321.pair.com?node_id=11117029


in reply to How to sub class-es

I think you've got plenty great and actually-useful answers to your question, so I'm gonna overthink it for a sec. You've already figured out that this is a "has-a" situation, so we can lean into that. I submit that you have a "RobotPart" class with the method "Register", meant to return a hash table of functions and names. You have a "RobotDelegate" class that collects all of these parts, registers them all, and houses the combined hash tables.

Unfortunately I have to go and can't type out a demo of what I'm thinking, but hopefully I got the point across. Some things to thing about: