Hi, I wrote a simplified version of a program I was having a problem with, to better illustrate my questions:
1. How do I bypass this error?
2. What is the exact cause?
and the error that spits out:Code:#include <iostream> using namespace std; class Stuff { public: Stuff(); Stuff(int); Stuff(const Stuff&); int accessor(); void mutator(int); private: int mystery; }; Stuff::Stuff(): mystery(0) {} Stuff::Stuff(int b): mystery(b) {} Stuff::Stuff(const Stuff& b) { mystery = b.accessor(); } int Stuff::accessor() { return mystery; } void Stuff:: mutator(int b) { mystery = b; } int main() { Stuff fool; cout << fool.accessor() << endl; return 0; }
Thanks dudes.Code:bash-3.00$ !g g++ test.c test.c: In copy constructor `Stuff::Stuff(const Stuff&)': test.c:20: error: passing `const Stuff' as `this' argument of `int Stuff::accessor()' discards qualifiers bash-3.00$

