You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
345 B
29 lines
345 B
4 years ago
|
class A(object):
|
||
|
x:int = 1
|
||
|
|
||
|
def get_A(self: "A") -> int:
|
||
|
return self.x
|
||
|
|
||
|
class B(A):
|
||
|
def __init__(self: "B"):
|
||
|
pass
|
||
|
|
||
|
class C(B):
|
||
|
z:bool = True
|
||
|
|
||
|
def set_A(self: "C", val: int) -> object:
|
||
|
self.x = val
|
||
|
|
||
|
a:A = None
|
||
|
b:B = None
|
||
|
c:C = None
|
||
|
|
||
|
a = A()
|
||
|
b = B()
|
||
|
c = C()
|
||
|
|
||
|
b.x = a.get_A()
|
||
|
a.x = b.get_A()
|
||
|
c.set_A(0)
|
||
|
|