C++ how to delete a structure?

前端 未结 11 1163
生来不讨喜
生来不讨喜 2020-12-31 03:42

Structure I created:

   struct VideoSample
  { 
      const unsigned char * buffer;
      int len;
  };

   VideoSample * newVideoSample = new VideoSample;
          


        
11条回答
  •  不知归路
    2020-12-31 04:14

    In C++ a structure is the exact same as a class except everything is public by default, where a class is private by default. So a structure can have a destructor and is freed with delete.

提交回复
热议问题