Is delete this allowed?

后端 未结 10 1381
-上瘾入骨i
-上瘾入骨i 2020-11-22 03:40

Is it allowed to delete this; if the delete-statement is the last statement that will be executed on that instance of the class? Of course I\'m sure that the ob

10条回答
  •  [愿得一人]
    2020-11-22 04:18

    You can do so. However, you can't assign to this. Thus the reason you state for doing this, "I want to change the view," seems very questionable. The better method, in my opinion, would be for the object that holds the view to replace that view.

    Of course, you're using RAII objects and so you don't actually need to call delete at all...right?

提交回复
热议问题