Error handling (try catch)
C++ Gurus
2
Posts
2
Posters
3.0k
Views
1
Watching
-
The access violation error isn't thrown (exceptions are thrown not errors) - it occurs when you access memory that you don't own.
Anyway you can initialize your pointers with 0 (null pointer) and then first check for 0 and only then call a member-function (to be a little more safer you can assign 0 to the pointer after you delete it then you detect the attempt to call function after the pointer is deleted)