J
jstorta
I have been running this scenario in my head for a while. In the
surface it seems fine, but I keep thinking that somehow it will cause
problems.
class A {
}
class B extends A {
}
class C extends A {
B myB;
}
Class B is a A
Class C is also a A but also has a B which is in turn a A.
Is there anything wrong with having a variable in a class of a type
that inherits from the same parent that the class itself inherits from?
Thanks.
surface it seems fine, but I keep thinking that somehow it will cause
problems.
class A {
}
class B extends A {
}
class C extends A {
B myB;
}
Class B is a A
Class C is also a A but also has a B which is in turn a A.
Is there anything wrong with having a variable in a class of a type
that inherits from the same parent that the class itself inherits from?
Thanks.