ex02 starting

This commit is contained in:
2026-03-21 17:12:14 +01:00
parent cbcc65b196
commit 5c54cbee03
7 changed files with 183 additions and 2 deletions

21
ex02/Array/Array.hpp Normal file
View File

@@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Array.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/21 17:04:01 by aortigos #+# #+# */
/* Updated: 2026/03/21 17:04:01 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ARRAY_HPP
# define ARRAY_HPP
# include <iostream>
# include "Array.tpp"
#endif

54
ex02/Array/Array.tpp Normal file
View File

@@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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);
}
};