I have two classes (say B & C) that both derive from a class (say A). Now I need to write a class (say D) that should dynamically derive either from B or C at runtime.
B, C & A are classes provided to me through libraries and the only class in my control is D class. How do I write D with respect to constraints mentioned above. Obviously B and C have come from different vendors and hence would need different methods to be overridden in D depending on which is its parent class.
I cannot write different versions of D that would subclass from B & C since the override methods would have same code under different method names.
Aucun commentaire:
Enregistrer un commentaire