use*_*967 2 c++ inheritance class
我收到错误"'之前的预期类型说明符';' 令牌"在下面标记的代码行中.是否要求指定(*this)的类型?为什么编译器不知道(*this)的类型?
struct P{
};
struct R : public P{
virtual P* copy(){
return new(R(*this)); //error here
}
};
Run Code Online (Sandbox Code Playgroud)