0
Under review
适配器c++用例代码有错误,Adapter *adapter = Adapter(adaptee); 编译失败
Adapter *adapter = Adapter(adaptee);
是不是应该写成
Adapter adapter = Adapter(adaptee);
Customer support service by UserEcho
Hi!
Sorry, I'm not a C++ developer, but when I try to compile your version, I get this error:
main.cc:87:11: error: no viable conversion from 'Adapter *' to 'Adapter'
Adapter adapter = new Adapter(adapted);
Any advice? I'm using Apple clang version 12.0.0
我没编过你说的这段代码,不过按我的理解,你可以试试 Adapter adapter(adaptee); 或 Adapter *adapter = new Adapter(adaptee);