🔨」 fix(ex01): fixed constructors

This commit is contained in:
2025-08-26 22:50:49 +02:00
parent 021636df08
commit 98041eb662
3 changed files with 9 additions and 9 deletions

View File

@@ -11,18 +11,18 @@ Span::Span(void)
{
}
Span::Span(unsigned int size)
Span::Span(const unsigned int &size)
: _size(0), _max_size(size)
{
}
Span::Span(Span &other)
Span::Span(const Span &other)
: _size(other._size), _max_size(other._max_size)
{
this->_data = other._data;
}
Span &Span::operator=(Span &other)
Span &Span::operator=(const Span &other)
{
this->_max_size = other._max_size;
this->_size = other._size;
@@ -35,7 +35,7 @@ Span::~Span(void)
{
}
void Span::addNumber(int value)
void Span::addNumber(const int &value)
{
if (_size == _max_size)
throw std::runtime_error("max span size reached");