cpp04/ex01/Brain.cpp

37 lines
608 B
C++

#include "Brain.hpp"
Brain::Brain()
{
int i = 0;
while (i < 100)
{
std::ostringstream oss;
oss << "idea" << i;
ideas[i] = oss.str();
i++;
}
std::cout << "Brain def constructor called\n";
}
Brain::Brain(const Brain &other)
{
*this = other;
std::cout << "Brain copy constructor called\n";
}
Brain &Brain::operator=(const Brain &other)
{
int i = 0;
while (i < 100)
{
ideas[i] = other.ideas[i];
i++;
}
std::cout << "Brain copy assignment constructor called\n";
return (*this);
}
Brain::~Brain()
{
std::cout << "Brain deconstructor called\n";
}