//: C06:Stash2.h
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
// With constructors & destructors
#ifndef STASH2_H
#define STASH2_H
class Stash
{
/* Size of each space */
int size;
/* Number of storage spaces */
int quantity;
/* Next empty space */
int next;
/* Dynamically allocated array of bytes: */
unsigned char* storage;
void inflate(int increase);
/*In questo caso, al contrario del precedente file clib.h, si usa un costruttore e un distruttore, al posto delle funzioni "initialize" e "cleanup". */
public:
Stash(int size);
~Stash();
int add(void* element);
void* fetch(int index);
int count();};
#endif // STASH2_H ///:~