38 lines
485 B
C++
38 lines
485 B
C++
|
/*
|
||
|
* 02_CPP06.cpp
|
||
|
*
|
||
|
* Created on: 21.06.2018
|
||
|
* Author: hendrik
|
||
|
*/
|
||
|
|
||
|
#include <iostream>
|
||
|
using namespace std;
|
||
|
|
||
|
template<typename T, int s> class myarray {
|
||
|
private:
|
||
|
T* aptr;
|
||
|
unsigned int uisize;
|
||
|
public:
|
||
|
myarray(unsigned int pUisize) {
|
||
|
aptr = new T[uisize = s];
|
||
|
}
|
||
|
|
||
|
myarray() {
|
||
|
aptr = new T[uisize = s];
|
||
|
}
|
||
|
|
||
|
~myarray() {
|
||
|
delete[] aptr;
|
||
|
}
|
||
|
T& operator[ ](int iindex) {
|
||
|
return (aptr[iindex]);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
int main() {
|
||
|
|
||
|
myarray <int, 10> intarray;
|
||
|
|
||
|
cout << "End";
|
||
|
}
|