标签:
三种形式:
classScreen{ public: typedef std::string::size_type index; //implicitly inline when defined inside the class declaration char get()const{return contents[cursor];} //explicitly declared as inline;will be defined outside the class declaraton inline char get(index ht, index wd)const; //inline not specified in class declaration,but can be defined inline later index get_cursor()const; //... }; //inline declared in the class declaration; no need to repeat on the definition charScreen::get(index r, index c)const { index row = r * width;//compute the row location return contents[row + c];//offset by c to fetch specified c haracter } //not declared as inline in the class declaration, but ok to make inline in definnition inlineScreen::index Screen::get_cursor()const { return cursor; }
标签:
原文地址:http://www.cnblogs.com/codetravel/p/4534526.html