The children of `EntityGroup` should extend from `...
# announcements
r
The children of
EntityGroup
should extend from
EntityBase<T>
so I can have both `Entity`s and `EntityGroup`s in there.
m
r
I was using something like that before, but I actually have several of these patterns that all come from the same
BaseClass
and I was hoping for more type safety. (I don't want the children of
EntityGroup
to take any
Showable
, I want to restrict it to `EntityBase`s.) Similar with
ItemGroup
and other
[Type]Group
classes.
m
I was suspecting that could be the case. Then use delegation instead of inheritance, put all group related stuff in a separate class and from each and every group you have, delegate to that object.
Delegation should remove a lot of boilerplate from your code.
r
Indeed. I'll try that. Thanks!
m
And still you would not have to do anything weird like using
Nothing
.
👍 1
class EntityGroup : EntityBase, Group<EntityBase> by GroupImpl()
or something like this.