|
|
|
|
|
by mpyne
4913 days ago
|
|
Nice article, but I just wanted to throw out that if being able to call a class method on a null object in C++ is desirable, you can actually check for that condition instead of just crashing. if(!this) return false; // Or whatever
Of course it's open for debate as to whether this is something to encourage, but it can help from having to use a Null Object pattern in some situations. |
|
I think you mean non-virtual method, not 'class method' or static method which wouldn't have a this pointer.