class TestGet : public ::testing::Test
{
protected:
TestGet()
: _txHandle(11)
{
_interface.get = mockGet;
}
Interface_T _interface;
Handle_T _txHandle;
DB _db;
};
如果我更改DB
为仅具有以下构造函数:
explicit DB(Interface_T& _interface):
_interface(interface)
{
}
我现在是否需要在我的类中声明_db
使用 a并在构造函数中对其进行初始化?std::shared_ptr
TestGet
_interface
更新:
问题是我有:
private:
Interface_T _interface;
在 DB 类而不是引用中。