Objects. Encapsulation of related fields and operations to make it easier to reuse and work with code. Easy enough!

Polymorphism. The ability to have objects behave in the same manner, through inheritance, interface, etc. Gotcha.

Now let's give this Object-Polymorphism thing a try ...

        if(obj instanceof MMSNode) {
            MMSNode node = (MMSNode)obj;
            attribs = node.getAttribs();
        }
        else if(obj instanceof MMSPhysComp) {
            MMSPhysComp physComp = (MMSPhysComp)obj;
            attribs = physComp.getAttribs();
        }
        else if(obj instanceof MMSLogComp) {
            MMSLogComp logComp = (MMSLogComp)obj;
            attribs = logComp.getAttribs();
        }
        else if (obj instanceof MMSPhysLink) {
            MMSPhysLink physLink = (MMSPhysLink)obj;
            attribs = physLink.getAttribs();
        } 
        [code discovered by David Shay]

Awww yeah, looks good to me! Just call me Mr. Object Oriented!

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!