dlang语言最新dmd2103版本以下代码我实现一个类的opAssign方法的时候报错如下帮我纠正 a_2d565 Error function a_2PhpValueopAssign!_VariantopAssign cannot override a non-virtual function a_2d124 Error template instance a_2PhpValueopAssig
根据错误提示,你正在尝试重载一个非虚函数,而opAssign方法必须是虚函数。为了解决这个问题,你需要在类定义中将opAssign方法声明为虚函数。例如:
class PhpValue
{
// ...
virtual this opAssign(T)(T value)
{
// implementation
}
// ...
}
这样就能够重载opAssign方法了。
原文地址: https://www.cveoy.top/t/topic/fiVg 著作权归作者所有。请勿转载和采集!