帮小弟看下c++指针访问成员函数的错误吧

telnetor telnetor 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include<iostream.h>
class AnotherDate{
private:
int year;
int month;
int day;
public:
void setDate(int y,int m,int d){
year=y;
month=m;
day=d;
}
int isLeapYear(){
return (year%4==0&&year%100!=0)||(year%400==0);
}
void print(){
cout<<"year:"<<year<<",month:"<<month<<",day:"<<day<<endl;
}
};
void main(){
AnotherDate *date;
date->setDate(1980,3,1);
date->print();
}

编译能通过,但就是运行不起来,不知道怎么回事,希望大家帮帮我,多谢拉
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
telnetor
新手乐园 33,315 成员 41,769 内容