C
C#15mo ago
Sygmond

❔ Inheritance Tricky Question

If ListPage and DetailPage have TitlebarButtons but also other buttons outside of the titlebar... than ListPageButtonSettings and DetailPageButtonSettings should inherit TitlebarButtonSettings or TitlebarButtonSettings should be a property inside of ListPageButtonSettings and DetailPageButtonSettings? Someone told me that a class should not inherit another class if the parent class is not of the same nature, like in my case, ListPageButtonSettings is not a TitlebarButtonSettings and it contains other button settings not related to titlebar.
2 Replies
Hazel 🌊💃
Hazel 🌊💃15mo ago
I'd concur that you should favor composition over inheritance here by making the title bar settings a property of each. While they have that common property, how similar are the pages themselves? If you absolutely need a way to extract title bar settings out of each page's button configurations then you can create an interface that defines the property for you instead. Then implement that interface on both models for a common link.
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server