A
Andrey Vul
In the following:
class Foo {
public:
int bar() const {
return bar;
int bar(int newbar) {
return (bar = newbar);
}
bool operator==(const Foo& rhs) {
return (bar() == rhs.bar()); // error here
}
private:
int bar;
}
Where in ISO C++ does the distinction between function return value
and variable exist? My compiler (MSVC 10) chooses the variable itself
and dies about needing a (pointer to) function type, as opposed to
doing the smart thing and comparing the return values of the getters.
And is the compiler allowing get/set overloading with member part of C+
+0x?
class Foo {
public:
int bar() const {
return bar;
int bar(int newbar) {
return (bar = newbar);
}
bool operator==(const Foo& rhs) {
return (bar() == rhs.bar()); // error here
}
private:
int bar;
}
Where in ISO C++ does the distinction between function return value
and variable exist? My compiler (MSVC 10) chooses the variable itself
and dies about needing a (pointer to) function type, as opposed to
doing the smart thing and comparing the return values of the getters.
And is the compiler allowing get/set overloading with member part of C+
+0x?