大家好,又见面了,我是你们的朋友全栈君。
void CObject::AssertValid()
const //说明:该成员函数只能对成员变量做”引用型”操作,不能做”加工型”操作
{
ASSERT(this != NULL);
}
MSDN:
When you write your own class, you should override the AssertValid function to provide diagnostic(诊断) services for yourself and other users of your class. The overridden AssertValid usually calls the AssertValid function of its base class before checking data members unique to the derived class.
Because AssertValid is a const function, you are not permitted to change the object state during the test. Your own derived class AssertValid functions should not throw exceptions but rather should assert whether they detect invalid object data.
DEMO:
请查看MSDN中CObject
转载于:https://www.cnblogs.com/shanzy/archive/2005/12/17/299229.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/159756.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...