diff --git a/ex02/Array/Array.hpp b/ex02/Array/Array.hpp index fd1ee32..dc69368 100644 --- a/ex02/Array/Array.hpp +++ b/ex02/Array/Array.hpp @@ -16,6 +16,24 @@ # include -# include "Array.tpp" +template +class Array +{ + private: + T *data; + unsigned int _size; + + public: + Array(); + Array(unsigned int n); + Array(const Array &other); + Array &operator=(const Array &other); + ~Array(); + + T &operator[](unsigned int i); + unsigned int size() const; +}; + +#include "Array.tpp" #endif diff --git a/ex02/Array/Array.tpp b/ex02/Array/Array.tpp index 966e095..7c887ce 100644 --- a/ex02/Array/Array.tpp +++ b/ex02/Array/Array.tpp @@ -6,49 +6,56 @@ /* By: aortigos creates an empty array +// Construction with an unsigned int n as parameter +// Consctrucion by copy and assignment operator +// operator new [] to allocate memory +// Access elements by operator [] +// Exception if access index out of bounds +// Function size + template -class Array +Array::Array() : data(NULL), _size(0) { - private: - T *element; - unsigned int size; - public: - Array() - { - new T[n](); - } + // std::cout << "Default constructor called" << std::endl; +} - Array(const Array &other) - { - if (this != other) - { - this->element = other.element; - this->size = other.size; - } - return (*this); - } +template +Array::Array(unsigned int n) +{ - Array& operator=(const Array &other) - { - this = other; - } +} - ~Array() - { - delete[] T; - } +template +Array(const Array &other) +{ - Array(unsigned int n) - { - this->size = n; - } +} - int size() - { - return (this->size); - } -}; +template +Array &operator=(const Array &other) +{ + +} + +template +~Array() +{ + +} + +template +T &operator[](unsigned int i) +{ + +} + +template +unsigned int size() const +{ + +}