zoukankan      html  css  js  c++  java
  • codetemp2: CObject::AssertValid()

    原型:[virtual]
    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

  • 相关阅读:
    PAT甲级1137Final Grading
    晚测6
    模拟15
    模拟14
    模拟13
    晚测5
    晚测4
    模拟11
    7012. 2021.03.15【2021省赛模拟】十
    7011. 2021.03.13【2021省赛模拟】nonintersect
  • 原文地址:https://www.cnblogs.com/shanzy/p/299229.html
Copyright © 2011-2022 走看看