'CObject::operator =' : cannot access private member declared in
class 'CObject'
Hello!
I'm trying to implement a simple representation of a graph. Here is the
code:
//--------vertex.h------------
#pragma once
class CVertex : public CObject
{
public:
CVertex();
virtual ~CVertex();
protected:
int m_xPos;
int m_yPos;
CPtrList m_neigbors;
public:
virtual int const GetXPos(void);
virtual int const GetYPos(void);
virtual void SetXPos(int newXPos);
virtual void SetYPos(int newYPos);
virtual void AddNeighbor(CVertex* vertex);
virtual CPtrList* const GetNeighbors();
};
//--------graph.h------------
#pragma once
#include "vertex.h"
class CGraph : public CObject
{
public:
CGraph();
virtual ~CGraph();
protected:
CList<CVertex, CVertex&> vertices;
};
Now I get the following compiler error:
error C2248: 'CObject::operator =' : cannot access private member
declared in class 'CObject'
....
This diagnostic occurred in the compiler generated function 'CVertex
&CVertex::operator =(const CVertex &)'
What is going wrong here it must have something todo with the CList
object, but why is there some sort of operator overloading needed? The
default (comparing two pointer adresses) should do the job for that
CList. What am I missing here?
Thanks for any help!
Maik