If possible, not examples with print. But more like with real arguments
Really basic example :
class A:
def __init__(self):
pass
def create_project(self,argA):
newA = call createFromA(argA)
return newA
class Constructor:
def __init__(self):
pass
def modifA(Abis):
Abis = Abis Abis
return Abis
def createFromA(self,argA):
A = 2*argA
A = modifA(A)
return A
cons = A()
cons.create_project(2)
Can someone shed me some light on how I can call createFrom into the outer class
CodePudding user response:
createFromA
needs to be a staticmethod
as it does not operate on instances of the class Constructor
class A:
def __init__(self):
pass
def create_project(self,argA):
newA = self.Constructor.createFromA(argA)
return newA
class Constructor:
def __init__(self):
pass
@staticmethod
def createFromA(argA):
A = 2*argA
return A
cons = A()
cons.create_project(2)