55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Array.tpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2026/03/21 17:09:36 by aortigos #+# #+# */
|
|
/* Updated: 2026/03/21 17:11:51 by aortigos ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
template <typename T>
|
|
class Array
|
|
{
|
|
private:
|
|
T *element;
|
|
unsigned int size;
|
|
public:
|
|
Array()
|
|
{
|
|
new T[n]();
|
|
}
|
|
|
|
Array(const Array &other)
|
|
{
|
|
if (this != other)
|
|
{
|
|
this->element = other.element;
|
|
this->size = other.size;
|
|
}
|
|
return (*this);
|
|
}
|
|
|
|
Array& operator=(const Array &other)
|
|
{
|
|
this = other;
|
|
}
|
|
|
|
~Array()
|
|
{
|
|
delete[] T;
|
|
}
|
|
|
|
Array(unsigned int n)
|
|
{
|
|
this->size = n;
|
|
}
|
|
|
|
int size()
|
|
{
|
|
return (this->size);
|
|
}
|
|
};
|