- 博客(2)
- 收藏
- 关注
原创 c++构造函数不能使用shared_from_this
类定义:class ctest : public enable_shared_from_this{public:ctest(){shared_from_this();}};以下构造方式为例:shared_ptr st(new ctest());分为两部分执行:1,先执行new ctest(),将ctest对象构造出来,此时enable_shared_from_this内的_...
2019-09-02 20:07:51
863
原创 c++友元
友元函数和友元类:/*实现类之间的数据共享,减少系统开销,提高效率,是的其它类能直接访问该类的私有成员友元破坏了封装机制,尽量避免使用*/#include <iostream>#include <string>#include <memory>using namespace std;class friend_test;cl...
2019-08-31 20:55:29
75
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人