SmartVessel

Foucs on C++

博客园 首页 新随笔 联系 订阅 管理

2011年7月11日 #

摘要: A simple (and perhaps overused) example of RAII is a File class. Without RAII, the code might look something like this: File file("/path/to/file");// Do stuff with filefile.close(); In other words, we must make sure that we close the file once we've finished with it. This has two drawb 阅读全文
posted @ 2011-07-11 16:10 SmartVessel 阅读(261) 评论(0) 推荐(0) 编辑