I'm using visual studio.
I have 3 class. It's ok when I try to print Rectangle ABCD, but when i push ABCD into Array [rectangle] A and try to print ABCD again, the "wntdll.pdb not loaded" appear and i continue, it's "triggers breakpoint error!!" at delete in ~Rectangle()
I know it's something up to the pointer in class Rectangle but can't firgure out.
`int main(){
    Array<Rectangle>A;
    Rectangle a;
    cout << a;     //It's oke
    A.PushBack(a); // problem here
    cout<<a;
}`
    class Point
    {
    private:
       float _x;
       float _y;
    public:
       float GetX() { return _x; }
       float GetY() { return _y; }
    public:
       Point();
       Point(float, float);
       Point(const Point&);
       ~Point() {};
    public:
       string ToString() const;
    public:
       friend istream& operator>>(istream&, Point*);
       friend ostream& operator<<(ostream&, const Point&);
    };
    Point::Point() {
       _x = 1;
       _y = 1;
    }
    Point::Point(float x, float y) {
       _x = x;
       _y = y; 
    }
    Point::Point(const Point& a) {
       _x = a._x;
       _y = a._y;
    }
    string Point::ToString() const{
       stringstream out;
       out << "( " << _x << "," << _y << " )";
       return out.str();
    }
    istream& operator>>(istream& in, Point* a) {
       cout << "Nhap x: ";
       in >> a->_x;
       cout << "Nhap y: ";
       in >> a->_y;
       return in;
    }
    ostream& operator<<(ostream& out, const Point& a)
    {
       out << a.ToString();
       return out;
    }
    ```
class Rectangle
{
private:
    Point* _topleft;
    Point* _botright;
public:
    void Set_topleft(Point tl) { _topleft = &tl; }
    Point Get_topleft() { return *_topleft; }
    void Set_botright(Point br) { _botright = &br; }
    Point Get_botright() { return *_botright; }
public:
    Rectangle();
    Rectangle(Point*, Point*);
    ~Rectangle();
public:
    string ToString() const;
public:
    friend istream& operator>>(istream&, Rectangle&);
    friend ostream& operator<<(ostream&, const Rectangle&);
};
Rectangle::Rectangle()
{
    _topleft = new Point(0, 2);
    _botright = new Point(3, 0);
}
Rectangle::Rectangle(Point* a, Point* b)
{
    _topleft = new Point(*a);
    _botright = new Point(*b);
}
Rectangle::~Rectangle()
{
    delete _topleft;
    delete _botright;
}
string Rectangle::ToString() const
{
    stringstream out;
    out << "A" << *_topleft << "+" << "D" << *_botright;
    return out.str();
}
istream& operator>>(istream& in, Rectangle& a)
{
    std::cout << "A( x,y ): ";
    in >> a._topleft;
    std::cout << "D( x,y ): ";
    in >> a._botright;
    return in;
}
ostream& operator<<(ostream& out, const Rectangle& a)
{
    out << a.ToString();
    return out;
}
```
    template<class T>
    class Array
    {
    private:
        T* _a;
        int _len;
    public:
        Array();
        ~Array();
    public:
        int length() { return _len; }
        void PushBack(T);
        T GetAt(int);
    };
    template<class T>
    Array<T>::Array() {
        _a = new T[128];
        _len = 0;
    }
    template<class T>
    Array<T>::~Array() {
        delete[] _a;
        _len = 0;
    }
    template<class T>
    void Array<T>::PushBack(T value) {
        if (_len >= 128)
        {
            std::cout << "Array is over size, which is 128\n";
            return;
        }
        _a[_len] = value;
        _len++;
    }
    template<class T>
    T Array<T>::GetAt(int pos) {
        return _a[pos];
    }
    ```
 
    