「🔨」 fix(ex01): fixed constructors
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user