标签:nbsp inner pytho RoCE __name__ oop tor process 实例
# _*_ utf-8 _*_: # author:Administrator class myouter: def __init__(self,name): self.name=name def output(self): print("这是外部类{name}".format(name=self.name)) class myinner: def __init__(self,inname): self.inname=inname def output(self): print("这是内部类{name}".format(name=self.inname)) if __name__=="__main__": p=myouter(‘parent‘) p.output() q=myouter.myinner(‘son‘) q.output()
D:\软件安装\Python3.7.4\python.exe E:/python/pythonfile20190907/OOP4.py
这是外部类parent
这是内部类son
Process finished with exit code 0
标签:nbsp inner pytho RoCE __name__ oop tor process 实例
原文地址:https://www.cnblogs.com/ybl20000418/p/11491383.html