I have two classes, suppose A and B. Inside B, I create A.
I have a function func()that is required by both classes.
How should I do it? I thought about this:
class A:
func()
class B:
x = A()
func()
def func():
And then I can access func () from A or B. Is this approach used in order or is there a better way to do this (maybe using the OO approach)
Note that I'm new to OO programming, so I'm interested in whether I can apply any OO design to it.
Edit: a function may differ in the arguments it takes.
Chris source
share