Constructing Mixins
This may be a very basic OOP question:
I have 2 class that aren't in the same hierarchy. But both classes have
some methods that are identical in its code. Those methods implement the
"UI" of their classes. I am planning to move those methods into a mixin,
and have both classes inherit that mixin.
Problem is: those methods currently need to refer to attributes of their
classes (because they are essentially UI's of the class): eg: they both
refer to self.MyVar(), which is defined differently in class A and class
B.
How can I construct my mixin in this case?
No comments:
Post a Comment