Circle Inheritance? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Circle Inheritance?

I know that in Python its not possible to inherit classes so you can make a circle. But is it possible in other programming languages? (C++, Java, Ruby)

16th Aug 2018, 7:52 PM
Dokick
Dokick - avatar
2 Answers
0
just by thinking about it, i dont think this is possible, as this would mean that classes inherit themselves at one point (and will have to inherit everything in an infinite loop, woo) also, i just tried making something like this in cpp. I couldnt make base class inherit from the daughter class, as for this i have to define daughter class before the base class, and then compiler complains about redifinitions and incomplete types
16th Aug 2018, 9:46 PM
Data
Data - avatar
0
The only language I'm aware of that supports circular inheritance is Unicon.
17th Aug 2018, 7:51 AM
BlazingMagpie
BlazingMagpie - avatar