C++要仔细manage resources, 比如memory, file, connection

来源: 2007-11-14 07:28:10 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

如果这些东西是class memeber,你就要自己implement copy constructor, = and destructor。通常是一起来的。C#因为有garbage collection这些东西简单些,养成用完的object = null,connection, file, stream 等都主动去close就好了。