Checking for a null object in C++

后端 未结 8 1092
南旧
南旧 2020-12-13 17:55

I\'ve mostly only worked with C and am running into some unfamiliar issues in C++.

Let\'s say that I have some function like this in C, which would be very typical:<

8条回答
  •  甜味超标
    2020-12-13 18:04

    C++ references naturally can't be null, you don't need the check. The function can only be called by passing a reference to an existing object.

提交回复
热议问题