Hi.
I have two classes, suppose A and B. Within B, I instantiate A.
I have a function func()
that is required by both the classes.
How should I go about it? I had thought of this approach:
class A:
func()
class B:
x = A()
func()
def func():
And then I can access func() from within A or B. Is this approach OK or is there a better way to do this (perhaps using an OO approach)
Note that I am new to OO programming and that is why I am interested in knowing whether I can apply any OO design to this.
Edit: The function can differ in the arguments it takes.