+ 7
What is circular inheritance?
2 Antworten
+ 6
its when you have a class that inherits from another class that inherits from the first class mentioned... let me explain better haha lets say this:
class A(B):
#body of class A
class B(A):
#body of class B
this code won't work because B is not defined when I create class A... but it proves the concept of circular inheritance. class A inherits from B and B from A... so you're just creating a loop of inheritance, and python would not be able to evaluate this since there's no way to look at any class individually.
It's called circular because you're closing a circle of inheritance by doing this.
Hope this helps
+ 5
it's when A is the superclass and B inherits from A, and C inherits from B, and A inherits from C, forming a circle