A class may have a member that is array and contains class instances.
Example
Output:
Explanation:
line 22
an empty array is declared.lines 46 - 48
elements are added to the array.
This can be done also via the function array_push
.lines 52 and 60
all elements of the array
are looped.lines 26 - 35
the array is sorted ascending by price.
If at line 27
the sign <
is
replaced with >
, then the sorting would be descending.