So I have this code:
Node* SceneGraph::getFirstNodeWithGroupID(const int groupID)
{
return static_cast<Node*>(mTree->getNode(groupID));
}
mTree->getNode(groupID) returns a PCSNode*. Node is publicly derived from PCSNode.
All of the docs I've found on static_cast say something to this effect: "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."
Yet, XCode's (GCC) compiler says that the static_cast is from PCSNode* to Node* is invalid and not allowed.
Any reason why this is? When I switch it to a C-style cast, there are no complaints from the compiler.
Thanks.
UPDATE: Even though the question was answered, I'll post the compiler error for completeness in case anyone else has the same problem:
error: Semantic Issue: Static_cast from 'PCSNode *' to 'Node *' is not allowed