class myouterclass(object):
def __init__(self,ID):
self.myouterclassID=myouterclassID
self.myinnerclass=self.MYINNERCLASS()
class MYINNERCLASS:
def __init__(self):
self.myinnerclassID=myinnerclassID
我正在尝试创建一个内部类,并创建一些包含ID的变量。为了简单起见,我还想使用ID来定义外部类的不同实例
我对自己做错了什么缺乏了解
我试图实现的是使用同一名称变量“ID”来定义外部类的不同实例的标识,并且使用同一名称变量“ID”来跟踪内部类对象“myinnerclass”的不同实例。我计划创建多个innerclass实例,我需要有不同的ID来跟踪它们
谢谢
也许是你想要的
相关问题 更多 >
编程相关推荐