Class: Store

Store()

Container class (Store) for holding shop items. Demonstrates the concept of Static Polymorphism (Generics).

Constructor

new Store()

Source:

Classes

Store

Methods

addItem(item)

Adds an item to the store with a type check.

Parameters:
Name Type Description
item ShopItem

An element that inherits from ShopItem.

Source:
Throws:

If the element does not inherit from ShopItem.

Type
Error

getTotalItemsCount() → {number}

Returns the total number of elements in the store.

Source:
Returns:

The count of items.

Type
number