Hello,
I am trying to get completely to grips with class inheritence in Python. I have created program's with classes but they are all in one file. I have also created scripts with multiple files containing just functions. I have started using class inheritence in scripts with multiple files and I am hitting problems. I have 2 basic scripts below and I am trying to get the second script to inherit values from the first script. The code is as follow's:
First Script:
class test():
def q():
a = 20
return a
def w():
b = 30
return b
if __name__ == '__main__':
a = q()
b = w()
if __name__ == '__main__':
(a, b) = test()
Second Script:
from class1 import test
class test2(test):
def e(a, b):
print a
print b
e(a, b)
if __name__ == '__main__':
test2(test)
Can anyone explain to me how to get the second file to inherit the first files values? Thanks for any help.