I got a class Vectors which has private dynamic array.
All I wanted to do is to add two Vectors objects like A = A + B, but the program keeps crashing.
This is declaration of my class:
class Vectors
    {
    private:
        int* vector;
    public:
        Vectors(int);
        Vectors(Vectors&);
        ~Vectors();
        Vectors operator+(Vectors&);
    };
This is my implementation:
#include "Vectors.h"
#include "iostream"
using namespace std;
Vectors::Vectors(int value)
{
    this->vector = new int[3];
    for (auto i = 0; i < 3; i++)
    {
        vector[i] = 3;
    }
}
Vectors::Vectors(Vectorsy& copy)
{
    this->vector = new int[3];
    for (auto i = 0; i < 3; i++)
    {
        vector[i] = copy.vector[i];
    }
}
Vectors::~Vectors()
{
    delete[] vector;
}
Vectors Vectors::operator+(Vectors& obj) // There is sth wrong here.
{
    for (auto i = 0; i < 3; i++)
        this->vector[i] += obj.vector[i];
    return *this;
}
This is the error I get:

 
     
     
    