C++程序员应了解的那些事(74)final关键字 + ostream_iterator(cout,“ “)
作者:互联网
【C++11之final关键字】
<1>禁用继承
C++11中允许将类标记为final,使用时直接在类名称后面使用关键字final,如此,意味着继承该类会导致编译错误。示例如下:
class Super final
{
//......
};
<2>禁用重写
C++中还允许将方法标记为fianal,这意味着无法在子类中重写该方法。这时final关键字放在方法参数列表后面,示例如下:
class Super
{
public:
Super();
virtual void SomeMethod() final;
};
【ostream_iterator(cout," ")的含义】
- Constructs an ostream_iterator that is initialized and delimited(带分隔符的) to write to the output stream.
- 构造一个带分隔符的ostream_iterator,该迭代器用来写入输出流。
ostream_iterator(
ostream_type& _Ostr
);
ostream_iterator(
ostream_type& _Ostr,
const CharType* _Delimiter
);
Parameters
_Ostr
The output stream object used to initialize the output stream pointer.
_Delimiter (分隔符)
The output stream delimiter used to initialize the output stream pointer.
标签:cout,stream,C++,ostream,output,iterator,final 来源: https://blog.csdn.net/qfturauyls/article/details/110453397