为什么我在以下代码片段中收到 UMR(未初始化内存读取)错误。调用派生类的复制构造函数时出现 UMR 错误
class base{
public :
base(int);
int id;
int getid()
{
return id;
}
};
base::base(int a)
{
id = a;
}
class derived:public base{
public :
derived(derived &);
int inum;
int getnum()
{
return inum;
}
};
derived::derived(derived &d):base(d.getnum()) // UMR Error
{
inum = id;
}
任何人都可以知道实施有什么问题吗?