如何在子类中的方法之间引用 [英] how to cite between methods inside a subclass
本文介绍了如何在子类中的方法之间引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在这个子类ImDisp"中的方法之间引用,它的父类是mywindow".但是我发现在Bs"方法中,不能引用BsInf".为什么?
I would like to cite between methods inside this subclass "ImDisp", whose father class is "mywindow". But I found in "Bs" method, the 'BsInf' cannot be cited. Why?
class ImDisp(mywindow):
def __init__(self):
super(ImDisp,self).__init__()
def BsFig(self):
print('BsFig')
def BsInf(self):
print('BsInf')
def Bs(self):
self.BsInf #This doesn't work, why?
print('Bs')
推荐答案
你应该通过给函数对象添加括号来调用方法:
You should call the method by adding parentheses to the function object:
self.BsInf()
这篇关于如何在子类中的方法之间引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文