,为什么常见对象数组无效

求助,为什么常见对象数组无效?

#include "date.h"
#include <iostream>
using namespace std;
void main()
{
date d(1,2);
d.show();
d.setd(10,11);
d.show();
date d[2];
cout<<d[0]<<endl;
}




#pragma once
#include <iostream>
using namespace std;

class date
{
int x;
int y;
public:
date();
date(int x1,int y1):x(x1),y(y1){};
~date(void);
void setd(int x2,int y2){x=x2;y=y2;};
void show(){cout<<x<<"+"<<y<<endl;};
};



#include "date.h"


date::date(void)
{
x=y=0;
}


date::~date(void)
{
}


------解决思路----------------------
因为你没有重载<<
------解决思路----------------------
引用:
Quote: 引用:

因为你没有重载<<
怎么改?


    data s[2];
s[0].setd(5,6);
s[0].show();
------解决思路----------------------
对象无效是因为重复定义了d