It is said that a type name
cannot be defined inside a class after being used. e.g:
typedef double Money;
class Account {
public:
Money balance() { return bal; } // uses Money from the outer
private:
typedef double Money; // error: cannot redefine Money
Money bal;
// ...
};
The program doesn't work on GCC but on MSVC 14 it works fine!?? * I got this example from "C++ primer 5th edition".