Module demonstrating the concept of dynamic polymorphism by iterating over a heterogeneous array of ShopItem derivatives.
Methods
(inner) processShopItems(items)
Iterates over a collection of shop items and demonstrates polymorphism by calling their unique getDescription() and isPricy() methods.
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<ShopItem> | An array of objects inheriting from ShopItem. |