1
0
forked from s444409/POB_2019
POB_2019/zad7_3.cpp

27 lines
547 B
C++
Raw Normal View History

2019-05-05 21:01:16 +02:00
#include <iostream>
using namespace std;
template <typename type>
class Array {
private:
2019-05-13 20:54:13 +02:00
type* basePtr;
Array(unsigned int n){
basePtr=(type*)malloc(sizeof(type)*n); //allocate the memory
}
~Array(){
free(basePtr);
}
2019-05-05 21:01:16 +02:00
public:
2019-05-13 20:54:13 +02:00
Array& operator new [](unsigned int n){
Array(n);
2019-05-05 21:01:16 +02:00
return *this;
}
2019-05-13 20:54:13 +02:00
void* operator delete [](unsigned int n){
2019-05-05 21:01:16 +02:00
~Array();
}
2019-05-13 20:54:13 +02:00
type operator[](){
return
}
};