I have a Node class, containing the method
const char *GetNum() { return num; }
in it. In another method, MakeNum(), I use this code:
num = new char[strlen(parentNode.GetNum()) + sizeof(word)*3 + 1];
where parentNode is a const reference to a node.
When I try to compile it, I get this error:
node.cpp: In method `void Node::MakeNum(const Node &)':
node.cpp:76: passing `const Node' as `this' argument of `const char *
Node::GetN
um()' discards qualifiers
node.cpp:79: passing `const Node' as `this' argument of `const char *
Node::GetT
itle()' discards qualifiers
node.cpp:82: passing `const Node' as `this' argument of `const word
Node::GetNum
Child()' discards qualifiers
I have three .cpp files: node.cpp contains the methods' definitions,
test.cpp has a main() which declares a single Node, and doqspc.cpp has the
namespace declarations.
The program compiles using BC5.5 but when I run it, I get an exception, and
GCC simply refuses to compile it...
--------------------------
http://mudeth.tripod.com
|