[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: CPP Q
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-07-22 22:49:01
[Download RAW message or body]

On Sat, 22 Jul 2000, Thomas Zander wrote :
>Can anyone tell me what my compiler means (egcs) ?
>
>kword_frame.cc:2070: warning: passing `const KWGroupManager' as `this'
> argument of `struct KWGroupManager::Cell * KWGroupManager::getCell(int)'
> discards const
>
>method:
>KWGroupManager::KWGroupManager( const KWGroupManager &original )
>line 2070:
>    if(original.getCell(i))  {

Well, the compiler is right: you are calling a non-const method on a const 
object. If getCell doesn't modify the object (given the name, I guess it 
doesn't), then add "const" in the definition of the getCell method, _after_ 
the parameter list, both in the .h and in the .cc
A good C++ book would help :-)

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic