hi, I've this simple problem with "thinking in c++" page 476; the examples seems wrong or not completely and compiler gets an errror:
class HowMany2 {
std::string name;
public:
std::string getName() const ;
};
//main.cpp
std::string (HowMany2::*fp)() const = &HowMany2::getName(); //compiler require a static method
int main() {
fp = &HowMany2::getName();
}
class HowMany2 {
std::string name;
public:
std::string getName() const ;
};
//main.cpp
std::string (HowMany2::*fp)() const = &HowMany2::getName(); //compiler require a static method
int main() {
fp = &HowMany2::getName();
}
To copy to clipboard, switch view to plain text mode
What's wrong?
Bookmarks