阅读背景:

在成员函数中测试this-pointer是合法的C ++吗?

来源:互联网 

I have an application involving objects of different class types. The objects are referenced by pointers. A null pointer signifies that the associated object does not exist. Currently the calling codes is cumbersome, because each time it uses a pointer to an object, it tests the pointer value for null, and take some appropriate action it is null. Because the default action to be taken in the case of non-existence depends on the type of object, I would prefer to encode it in the classes for the objects themselves rather than in the calling program. This results in constructions like the following:I have an application involving objects of diff




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: