Menu

📰
0

What do people mean when they say composition is better than inheritance?

Reddit r/learnprogramming·u/ShoeChoice5567·about 1 month ago
#MeVZNrS7
Reading 0:00
15s threshold

What do people mean when they say composition is better than inheritance? For example, in some bank app there is an `Account` class, which is the superclass of `SavingsAccount` and `BusinessAccount`. How would you change this to composition? I don't get how composition would work here. I searched this and didn't find a satisfatory explanation. If it helps I study C#.

Read More