If I delete a class, are its member variables automatically deleted?

前端 未结 8 599
故里飘歌
故里飘歌 2020-12-13 06:28

I have been researching, and nothing relevant has come up, so I came here.

I am trying to avoid memory leaks, so I am wondering:

Say I have class MyCla

8条回答
  •  猫巷女王i
    2020-12-13 07:05

    Variables inside of a class have class scope and are destroyed when the class is. The only thing you need to worry about is pointers -- those will need to be addressed appropriately in your destructor.

提交回复
热议问题