缺少显式类型(假设为int)

Bra*_*don 1 c++ constructor header class

我不知道我做错了什么.这是一个非常简单的程序,我使用标题,类和构造函数来练习.它说我没有错过Header2.cpp中函数getValue()的返回类型.我不知道如何解决它.有任何想法吗?

TEST.CPP

#include <iostream>
#include <conio.h>
#include "Header2.h"

int main()
{
    Thing Implement(1);
    std::cout << "The truth value is: " << Implement.getValue() << std::flush << "/n";

    _getch();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Header2.h

#ifndef Object_H_
#define Object_H_

class Thing
{
public:
    Thing(int a);

int getValue();
private:
int truthValue;
};

#endif // Object_H_
Run Code Online (Sandbox Code Playgroud)

Header2.cpp

#include <iostream>
#include "Header2.h"

Thing::Thing(int a)
{
if (a != 0 || a != 1)
{
    std::cout << "Improper truth value." << std::flush;
}
else
{
    truthValue = a;
}
};

Thing::getValue()
{
return truthValue;
};
Run Code Online (Sandbox Code Playgroud)

gol*_*ode 6

你错过了一个int

int Thing::getValue()
{
return truthValue;
};
Run Code Online (Sandbox Code Playgroud)