A software design pattern used to enhance the functionality of an object at run-time is:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. Decorator
Explanation
The Decorator pattern wraps an object in another object that implements the same interface and adds behaviour before or after forwarding the call, so responsibilities can be attached to an individual object dynamically at run time without subclassing. Adapter does not add functionality; it converts one interface into another so incompatible classes can work together. Proxy also keeps the same interface but controls access to the object (lazy loading, remote access, protection) rather than enhancing its behaviour. Delegation is a general object-oriented technique, not one of the GoF patterns. Hence Decorator.More Programming Languages and Computer Graphics questions
- Module design is used to maximize cohesion and minimize coupling. Which of the following is the key to implement this rule?
- The design concept 'Refinement' is a:
- A software design is highly modular if:
- Cohesion is an extension of:
- Given 4 GB (≈ 4.3 × 10⁹ bytes) of virtual address space and a page size of 4 KB (= 4 × 10³ bytes), with each page table entry 5 bytes: how…
- A table T with 17 rows and 1024 columns is stored in memory. T[i][j] and the variable temp are 32-bit floating-point values; memory is word…