ArrayList or Object assignment?
I have class edge:
Code:
public class GraphMap
{
private ArrayList _vertices;
// ... deleted most of class, only important stuff...
public void addEdge( int start, int end, double dist )
{
Vertex tempVert = new Vertex();
tempVert = _vertices.get( start );
}
This gives me the compiler error:
Incompatible type for =. Can't convert Object to Vertex.
tempVert = _vertices.get( start );
Why is this happening and can I get around it? Does using ArrayLists limit me to added classes that inherit Object class? Can I write an assignment operator for my Vertex class, if so what would a sample declaration line look like?
NOMAD