Listing 1: A widget class with class specific allocation and deallocation functions that maintain memory available for widgets as a linked list


class widget
    {
public:
    static void *operator new(size_t n)
        throw (bad_alloc);
    static void operator delete(void *p)
        throw ();
    ...
private:
    struct chunk
        {
        ...
        chunk *next;
        };
    static chunk *available;
    ...
    };
//End of File