A class subclass of itself. Why mutual subclassing is forbidden?

后端 未结 6 639
天命终不由人
天命终不由人 2021-01-12 21:25

Complex question I assume, but studying OWL opened a new perspective to live, the universe and everything. I\'m going philosophical here.

I am trying to achieve a cl

6条回答
  •  感情败类
    2021-01-12 22:01

    I'm sure someone can up with an example where this makes sense. However, I guess this restriction is easier and not less powerful.

    Eg, Let's say class A holds fields a and b. Class C holds b and c. Then the view on things from C would be: A.a, C.b, C.c and the view from A would be: A.a, A.b, C.c.

    Just moving b into a common base class is far easier to understand and implement, though.

提交回复
热议问题