美文网首页
C++编译报错error: return type specif

C++编译报错error: return type specif

作者: popy32 | 来源:发表于2016-09-15 13:56 被阅读661次

    报错内容就是说构造函数不能含有特定的返回类型

    class Clock
    {
    public:
    
        Clock(int a,int b,int c);
    
        void setTime(void);
        void setTime(int newH,int newM,int newS);
        void showTime(void);
    private:
        int hour;
        int minute;
        int second;
    };
    
    void Clock::Clock(int a, int b, int c){
            hour=a;
            minute=b;
            second=c;
            
        }
    

    粗略看看并没有什么返回类型啊,其实错误就在void Clock::Clock(int a, int b, int c)这一行,去掉void即可正常编译。

    相关文章

      网友评论

          本文标题:C++编译报错error: return type specif

          本文链接:https://www.haomeiwen.com/subject/mqsbettx.html