So, I have this code:
Node* SceneGraph::getFirstNodeWithGroupID(const int groupID)
{
return static_cast<Node*>(mTree->getNode(groupID));
}
mTree-> getNode (groupID) returns PCSNode *. Node is publicly derived from PCSNode.
All the documents that I found in static_cast say this: "The static_cast operator can be used for operations such as converting a pointer to a base class to a pointer to a derived class."
However, the Xcode compiler (GCC) says that static_cast from PCSNode * to Node * is invalid and not allowed.
Any reason why this is so? When I switch it to C-style, the compiler has no complaints.
Thank.
UPDATE: Despite the fact that the question has been answered, I will post a compiler error for completeness if anyone else has a problem:
error: Semantic Issue: Static_cast 'PCSNode *' 'Node *'