Composition over inheritance
Software design pattern
Nº Q1780968 ★★
Incomum · Saberes
Composition over inheritance
Software design pattern
In object-oriented programming, composition over inheritance (sometimes composition with forwarding or composite reuse) is a common design pattern that tries to achieve code reuse without requiring inheritance. Instead of having two child classes inherit functionality from a common parent, composition simulates inheritance by having the children include a copy of a "pseudo-parent" class as a field, which implements the functionality common to the two classes.
Último preço
—
Preço mínimo
—
Mediana 7 d
—
Vendas 30 d
0
Faixa 30 d
—
Em circulação
0
Cotação
mediana
mín – máx
vendas
Sem vendas no período
Ver tabela
| Data | mediana | Mín | Máx | vendas |
|---|
Histórico de vendas
- Última venda
- —
- Média 30 d
- —
- Mínima 30 d
- —
- Máxima 30 d
- —
- Vendas 7 d
- 0
- Vendas 30 d
- 0
Ainda sem vendas.
Vendas anônimas: sem comprador nem vendedor. Os números contam só vendas entre jogadores.
Na Wikipédia
Texto em inglês Ainda não há artigo no seu idioma: trecho em inglês.
In object-oriented programming, composition over inheritance (sometimes composition with forwarding or composite reuse) is a common design pattern that tries to achieve code reuse without requiring inheritance. Instead of having two child classes inherit functionality from a common parent, composition simulates inheritance by having the children include a copy of a "pseudo-parent" class as a field, which implements the functionality common to the two classes. Then, methods that would have been called on the child are instead called on the pseudo-parent, a technique called method forwarding. Composition is generally used in languages where inheritance is unavailable or has an implementation that is considered inflexible, inconvenient, or inadequate (e.g. because a language lacks multiple inheritance). However, many problems that are easily solved with inheritance are difficult to solve using only composition; as a result, inheritance and object composition typically work hand-in-hand, as discussed in the book Design Patterns (1994).
Texto: Wikipédia em inglês, CC BY-SA 4.0. · Imagem: Sae1962 (CC BY-SA 3.0) ·