why do I need the braces ({}) in the following segment? When I tkae them away I get this error
Code:
#include "Main.h"
#include "Node.h"
#include "Data.h"
#include "InternalNode.h"
InternalNode::InternalNode(Data * dat, Node * next):
myData(dat), myNext(next)
{
}
Node * InternalNode::Insert(Data& dat) {
int result = myData->Compare(dat);
switch(result) {
case Smaller:
case Equal:
{Node * newNode = new InternalNode(&dat, this);return newNode;}
break;
case Bigger:
myNext = myNext->Insert(dat);
return this;
break;
default:
break;
}
return 0;
}
EDIT: Also is the way I passed in the reference to the constructor appropriate? I know there are better ways to do it, but I want this way for now as long as it will work