main后面加个()再试试
#include<iostream>
using namespace std;
class Date{
private:
int year;
int month;
int day;
public:
Date(int y,int m,int d){
year=y;
month=m;
day=d;
}
void print(){
cout<<year<<"-"<<month<<"-"<<day<<endl;
}
};
int main(){
Date today(2022,3,27);
today.print();
}