Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> class A():
- ... x = 5
- ... def __init__(self):
- ... self.y = 7
- ...
- ... class C(A):
- ... cx = 15
- ... def __init__(self):
- ... self.cy = 17
- ...
- ... cc = C()
- >>> cc.cy
- 17
- >>> cc.y
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- AttributeError: 'C' object has no attribute 'y'
- 'C' object has no attribute 'y'
- >>> cc.cx
- 15
- >>> cc.x
- 5
- >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement