rendered paste body@@ .h
#ifndef PAKOLTTOMB_H_
#define PAKOLTTOMB_H_
class PakoltTomb
{
private:
unsigned char* t;
int sz;
class Elem;
void setelement(int, unsigned char);
unsigned char getelement(int);
public:
@@ PakoltTomb(int,int);
PakoltTomb(const PakoltTomb&);
int len();
Elem& operator[](int x);
PakoltTomb& operator=(const PakoltTomb&);
~PakoltTomb();
private:
class Elem
{
friend class PakoltTomb;
private:
PakoltTomb* owner;
int index;
static Elem* temp;
Elem();
Elem(PakoltTomb*,int);
public:
Elem& operator=(unsigned char);
Elem& operator=(Elem&);
operator unsigned char();
};
};
#endif /*PAKOLTTOMB_H_*/
@@ .cpp
#include "PakoltTomb.h"
#include <iostream>
using namespace std;
int main()
{
@@
@@ PakoltTomb x;
@@
try
{
x = PakoltTomb(5,14);
x[1] = x[2] = x[8] = 1;
x[3] = x[4] = 3;
x[7] = x[3];
for(int i=0;i<x.len();i++)
{
int j = x[i];
cout << i << ":" << j << endl;
}
}
catch(const int s)
{
cout << s << endl;
return -1;
}
catch( char* s)
{
cout << s << endl;
return -1;
}
return 0;
}