what does this function declaration mean in c++

前端 未结 11 1868
-上瘾入骨i
-上瘾入骨i 2020-12-24 13:12
virtual const char* what() const throw()
{

}

AFAIK it\'s a function that will return a constant pointer to a mutable char. The rest I am not sure.

11条回答
  •  悲&欢浪女
    2020-12-24 13:20

    1. virtual: This means that the function can be reimplemented in subclasses, and calls to the method via a base class pointer will end up calling the reimplementation.

    2. const char * is not a constant pointer to a mutable char - it's the other way round.

    3. const means that this method can even be called on const instances of this class.

    4. throw() means that this method will not yield any exceptions.

提交回复
热议问题