class Test {
bool isVal() const {
return isVal;
}
private:
bool isVal;
};
On Compiling this file it says
testClass.cpp:9: declaration of `bool Test::isVal'
testClass.cpp:3: conflicts with previous declaration `bool Test::isVal()'
Although the same would work for java
class Test {
private boolean isVal;
public boolean isVal() {
return isVal;
}
}
Not sure why C++ cannot handle this.