Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > How to solve th...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 43941 of 47448
Post > Topic >>

How to solve this problem regarding the const qualifier?

by xz <zhang.xi.cn@[EMAIL PROTECTED] > Mar 16, 2008 at 02:28 PM

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(...){
....
};
};
 




 5 Posts in Topic:
How to solve this problem regarding the const qualifier?
xz <zhang.xi.cn@[EMAIL  2008-03-16 14:28:17 
Re: How to solve this problem regarding the const qualifier?
Ian Collins <ian-news@  2008-03-17 10:32:05 
Re: How to solve this problem regarding the const qualifier?
DDD <1983ddd@[EMAIL PR  2008-03-16 18:29:56 
Re: How to solve this problem regarding the const qualifier?
Andy Champ <no.way@[EM  2008-03-17 21:02:57 
Re: How to solve this problem regarding the const qualifier?
Martin York <Martin.Yo  2008-03-16 21:21:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 27 17:58:08 CDT 2008.