3 ms·
These concepts are orthogonal. I can use composition and inheritance to define an IS_A relationship and I can use them to define a HAS_A relationship. For exa
by hota_mazi 9y ago
These concepts are orthogonal.
I can use composition and inheritance to define an IS_A relationship and I can use them to define a HAS_A relationship.
For example, in Kotlin:
class A : B // IS_A via inheritance
class A(b: B) { // HAS_A via composition
class A(b: B) : B by b // IS_A via composition
- eiffel31 9y ago> class A(b: B) : B by b // IS_A via composition I couldn't find the "B by b" syntax from the Kotlin docs, can you tell me that this does ?