How can I override an C++ standard-library class function?

后端 未结 4 2066
长情又很酷
长情又很酷 2021-02-15 17:52

How can I override a C++ standard-library class function? In my application, I use ofstream objects in many different places of code. And now I want to open files i

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-15 18:46

    Another option would be to create a wrapper class that contains an 'ofstream' object and has the interface you want, and passes the work onto its 'oftstream' member. It would look like this.

提交回复
热议问题