Warning about hiding member variables?

后端 未结 3 1157
一向
一向 2020-12-11 04:17

The following code snippet has a memory leak that I spent too much time chasing down. The problem is that inside Foo(), the local variable x_ hides the member variable x_.

3条回答
  •  长情又很酷
    2020-12-11 04:50

    FWIW I wouldn't have this problem because I use a naming convention to distinguish member data from local variables: my member data identifiers are invariably prefixed with m_.

提交回复
热议问题