这里是我的代码: #include <iostream>
using namespace std;
int main()
{
void *x;
int arr[10];
x = arr;
*x = 23; //This is where I get the error
}
正如你所看到的,代码很简单。它只是创建一个void指针x,指向数组'ar
我有基类这样的: class Test {
public:
virtual void* getValue() {}
};
然后,我要创建几个派生类的实现getValue方法(它们将转换其地址为void *后返回不同类型的变量): class TestA : public Test {
private:
int value;
public:
TestA (