explicit
prevent use for implicit conversion in side a class
for example
explicit Array(int size);
This code prevent implicit conversion from int to Array class
default
Let compiler generate default functions.
delete
Remove the default implementation of a method
Array(const Array&) = delete;
for example, the above code prevents C++ from automatically creating copy constructor
noexcept
Optimize the code without worrying about exception. Does not guarantee there is no exceptions throw in the function.
override
Tell a virtual function it must override a function in the base class. Preventing override with different parameters.
final
disallow inheritance from class or function
for example
struct Base final{
}
Base struct cannot be inherited.
No comments:
Post a Comment