X
xz
I have a function foo as follows
void Foo::foo(const Vertex & a, const Vertex & b, const Vertex & c) {
Coordinate head;
a.calcSomething(......);
}
an got the following error information when compiling:
Foo.cpp:156: error: passing 'const Vertex' as 'this' argument of
'const void Vertex::calcSomething(......)' discards qualifiers
How to solve this problem? Isn't it enough to put calcSomething in the
following way?
class Vertex{
const void calcSomething(...){
....
};
};
void Foo::foo(const Vertex & a, const Vertex & b, const Vertex & c) {
Coordinate head;
a.calcSomething(......);
}
an got the following error information when compiling:
Foo.cpp:156: error: passing 'const Vertex' as 'this' argument of
'const void Vertex::calcSomething(......)' discards qualifiers
How to solve this problem? Isn't it enough to put calcSomething in the
following way?
class Vertex{
const void calcSomething(...){
....
};
};