class ExtendableStack is Stack
{
public:
function push (new_item: ItemType)
// override "push"
{ if (stack_top_index >= stack_size)
{
stack_size *= 2;
renew (buffer, stack_size);
}
Stack::push(new_item);
};
};
More examples: