what does this function declaration mean in c++

前端 未结 11 1930
-上瘾入骨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:42

    It's a virtual function that returns a const char*. The const at the end of the method means it is not allowed to change the state of the object it is called upon. Which means it is not allowed to modify any member variables of the object. throw() part is the exception specification that says the method doesn't throw any exception.

提交回复
热议问题