Computer scienceFundamentalsEssentialsSoftware constructionDesign patternsStructural design patterns

Composite pattern

Composite objects in code

Report a typo

Here's a simple example of composite pattern in pseudocode:

interface Catalog is
  method calculatePrice()


class СomputerParts implements Catalog is
  field hardware: array of Catalog
 
  constructor of СomputerParts ...

  method calculatePrice() is ...

  method addHardware() is ...


class Motherboard implements Catalog is
  constructor of CPU...
 
  method calculatePrice() is ...

Which of these classes are composite type?

Select one or more options from the list
___

Create a free account to access the full topic