Sorry, my title may not be very descriptive. Perhaps I can do better here
I have a class called Node. I am subclassing it to make a class called CustomNode.
Another class takes a reference to a vector of Node pointers:
Code:
void getNeighbouringNodes(Node *n, std::vector<Node*> &nodes);
I am calling it like this:
Code:
std::vector<CustomNode*> *nodes;
nodes = new (std::vector<CustomNode*>);
graph->getNeighbouringNodes(n, *nodes);
I get the error message:
error: non-const lvalue reference to type 'vector<class graphDB::Node *>' cannot bind to a value of unrelated
type 'vector<class CustomNode *>'
I understand the error I think: the method getNeighbouringNodes is expecting a refernce to a vector of Node pointers, but I am passing it a reference to a vector of CustomNode pointers. CustomNode pointers is a subclass of Node so I expect somehow I can pass a reference vector of CustomNode pointers into something expecting a reference vector of Node pointers?????
Thanks
Alex