标题:静态成员函数为什么不能调用静态数组呢????
取消只看楼主
sixleaves
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-10-21
结帖率:100%
 问题点数:0 回复次数:1 
静态成员函数为什么不能调用静态数组呢????
#include <iostream>
using namespace std;
class Event{
    private:
        int day;
        int month;
        static int year;
        static int m[13];
    public:
        int getDay(){return day;}
        int getMonth(){return month;}
        void setDay(int d){day = d;}
        void setMonth(int m){month = m;}
        void setYear(int y){ year = y;}
        int getYear(){return year;}
        int operator-(Event & e);
        static void setM();
};
void Event::setM(){
            int i,j;
            for(i = 1,j = 12;i < j;i++,j--){
                if(i%2)
                     m[i] = m[j] =31;
                 else
                     m[i] = m[j] =30;
                }
                m[7] = 31;
                if(year % 4)
                    m[2] = 29;
                else
                    m[2] = 28;
}
int Event::operator-(Event & e){
    Event::setM();
}

int main()
{
   
    return 0;
}
搜索更多相关主题的帖子: void private include public return 
2012-11-15 17:01
sixleaves
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-10-21
得分:0 
求解释啊???哪里错了??
2012-11-15 17:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-387158-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.058660 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved