C++ Access violation reading location 0xcdcdcdcd error on calling a function

前端 未结 5 1014
醉梦人生
醉梦人生 2020-12-06 21:26

Please consider the below scenario:

I have a header file and its corresponding source file:

exmp.h (Header file)

exmp.cpp (

5条回答
  •  温柔的废话
    2020-12-06 22:20

    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.

提交回复
热议问题