在线名词解释大全 - Python程序设计 - 详细

12.1Analyzethefollowingcode:classA:def__init__(self,i=0):self.i=iclassB(A):def__init__(self,j=0):self.j=jdefmain():b=B()print(B.i)print(B.j)main()

A

Class B inherits A, but the data field in i in A is not inherited.


B

Class B inherits A and automatically inherits all data fields in A.


C

When you create an object B, you have to pass an integer such as B(5).


D
The data field j cannot be accessed by object B.
正确答案:
相关推荐
扫描二维码
关注公众平台