我有一个CPolygon
从类派生的类CElement
。[我在这里使用多态性]。
class CElement : public CObject
{
public:
virtual ~CElement();
virtual void Draw(CDC* pDC){};
CPoint vertices[11];
protected:
CElement();
};
class CPolygon : public CElement
{
public:
CPolygon(CPoint mFirstPoint,CPoint mSecondPoint);
~CPolygon(void);
virtual void Draw(CDC* pDC);
protected:
CPoint mStartPoint;
CPoint mEndPoint;
CPolygon(void);
};
当我尝试将数组分配给vertices
CElement 对象的成员时,出现错误:expression must be a modifiable Lvalue
CElement* a = new CPolygon(mFirstPoint,mSecondPoint);
a->vertices=vertices; //here!!
为什么这不起作用?