how about creating a superclass which contains your doClassX method, and any attributes that doClassX uses from Class1 and Class2 and then let Class1 and Class2 inherit this new superclass, thus you can call doClassX on your Class1 and Class2 objects.
how about creating a superclass which contains your doClassX method, and any attributes that doClassX uses from Class1 and Class2 and then let Class1 and Class2 inherit this new superclass, thus you can call doClassX on your Class1 and Class2 objects.
As coward says, the doClassX process can be left abstracted in the super class if its to be the same for all subclasses. likewise the super class could be abstracted so that it cant be instantiated only via concrete sub classes..