Why the below piece of code is not crashing , though i have deleted the object?

后端 未结 10 1217
北海茫月
北海茫月 2021-01-18 02:29
class object
{
  public:
    void check()
    {
      std::cout<<\"I am doing ok...\"<

        
10条回答
  •  情话喂你
    2021-01-18 03:11

    You can do the same with nil pointers, just as long as you never access the state of the class instance:

    class object
    {
      public:
        void check()
        {
          std::cout<<"I am doing ok..."<check();
    }
    

提交回复
热议问题