Hello all. I'm relatively sure the problem I'm having can be fixed with a minor change in syntax somewhere (not sure what or where) but I just thought I would post it here in case anyone had any other ideas.
I have a PointManager class, which stores "Points." In this class, I have a method that basically checks whether each Point is the same subclass as it's neighbors. Here is said method:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
void PointManager::FindEdgesArcs() // should work once ConnectorManager::AddConnector() is implemented.
{
std::list<Point>::iterator second = PointList.begin(); // use two iterators for comparison purposes
if ( second != PointList.end() ) // Treat empty list
for(std::list<Point>::iterator first = second++; second != PointList.end(); ++first, ++second)
{
if((*first).GetType() == "edge" && (*second).GetType() == "edge") { _cManager.AddConnector(new Edge(&(*first), &(*second)));}
elseif((*first).GetType() == "edge" && (*second).GetType() == "arc") { _cManager.AddConnector(new Edge(&(*first), &(*second)));}
elseif((*first).GetType() == "arc" && (*second).GetType() == "arc") { _cManager.AddConnector(new Arc(&(*first), &(*second)));}
else { std::cout << "Not enough points to make an edge or arc" << std::endl;}
}
}
When I compile, everything is fine except I get the following error message:
"error: expected type-specifier before 'Arc'"
I don't get the error message for 'Edge,' even though both are subclasses of a class "Connector." Right now, 'Arc' and 'Edge' are basically the same class (need this working before I flesh them out).
Arc.h and Edge.h are both included in my ConnectorManager.h which is included in PointManager.h, so both should be included. Any ideas? Thanks for your help!
I am not using any namespaces in my project, as they usually screw me up rather than help.
Hah, I'm pretty sure the files are added but I will double check! Edit: Yeah, they're there :(
Ok, I don't know how I was supposed to figure this out, but apparently "Arc" is some sort of reserve word somewhere. I changed the class name to ArcC and now it compiles. -_-
Thank you for your help, clanmjc. It was good to go through this systematically with someone and know I wasn't just going crazy.