I'm working on a project involving a Dog eating Bones. Dog and Bone are both subclasses of Actor. Within the Bone class I have 3 subclasses called "RedBone", "PurpleBone", & "GreenBone".
Visual representation:
Actor
|> Dog
|> Bone
|> RedBone
|> PurpleBone
|> GreenBone
Basically, what I'm trying to do is remove the bone when the dog is touching a bone, no matter what color it is. This code will remove a Bone but it won't remove any of the colored subclasses. How could I apply this code so that it applies to all of the Bone colored subclasses.
if (isTouching(Bone.class))
{
removeTouching(Bone.class);
}

