How to destroy object in itself

前端 未结 4 771
再見小時候
再見小時候 2021-02-18 18:05

Is there any solution for destroying current instance of object in itself ?

I am looking for something which looks like:

class KillMe {
    ....
    pub         


        
4条回答
  •  情歌与酒
    2021-02-18 19:04

    No, objects cannot suicide. Any reference of itself is just a reference.

    To "clear" the object within itself one would just clear all instance variables.

    To "clear" the object outside itself one would set the variable equal to null.

提交回复
热议问题