形参表和函数体处于类作用域中,函数返回类型不一定在类作用域中,如果函数在类定义体之外定义,则用于返回类型的名字在类作用域之外,否则在类作用域内。
class Screen{
public:
typedef std::string::size_type size;
//not need to specific the screen::
inline size get_cursor() const;
private:
size width;
size height;
size cursor;
};
//should explicit specific the screen::
inline Screen::size Screen::get_cursor() const
{
return cursor;
}
//not need to specific the screen::
Screen::set_cursor(size cursor)
{
this->cursor = cursor;
}