Please consider the below scenario:
I have a header file and its corresponding source file:
exmp.h (Header file)
exmp.cpp (
You didn't initialize pointer, so you're calling empty memory. It is 0xcdcdcdcd and not some random stuff because of visual debugger.
ptr = new myClass();
This will do. But you don't have to use pointer in this case at all.