That's correct, try this code:
class A:
VarA = 1
def __init__(self) -> None:
self.prop_a=1
class B(A):
VarA = 2
def __init__(self) -> None:
self.prop_b=2
obj_a = A()
obj_aa = A()
obj_b=B()
obj_bb=B()
print(isinstance(obj_b,A))
print(A.VarA==1)
print(obj_a is obj_aa)
print(B.VarA == 1)
upvoted 3 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
kontra
1 year, 8 months ago9prayer
1 year, 9 months agoJnanada
2 years, 3 months agoblacksmokerr
2 years, 5 months agodeckman
2 years, 6 months agomacxsz
2 years, 6 months agomacxsz
2 years, 7 months agorocky48
2 years, 7 months agorocky48
2 years, 7 months agoNoarmy315
2 years, 10 months agoDTL001
2 years, 11 months agomazimir
3 years, 1 month agoMisco33
3 years ago