Skip to content

Commit ec8dbd1

Browse files
author
Liran Brimer
committed
fix is-a order in Prefer composition over inheritance description
1 parent 00a5068 commit ec8dbd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ depends on your problem at hand, but this is a decent list of when inheritance
15821582
makes more sense than composition:
15831583

15841584
1. Your inheritance represents an "is-a" relationship and not a "has-a"
1585-
relationship (Animal->Human vs. User->UserDetails).
1585+
relationship (Human->Animal vs. User->UserDetails).
15861586
2. You can reuse code from the base classes (Humans can move like all animals).
15871587
3. You want to make global changes to derived classes by changing a base class.
15881588
(Change the caloric expenditure of all animals when they move).

0 commit comments

Comments
 (0)