Hi.It's my first post in that forum so i hope not to post in wrong thread.Whatever.I have a project for my school and i have the following error on my code.The STORM_FileHandle sfh; is private.I want to use it on that function which is private on my class.REM_RecordFileHandle::ReadRecord(const REM_RecordID& rid,REM_RecordHandle& rh) const;When i use it i have the following error:REM/REM_RecordFileHandle.cpp: In member function 't_rc REM_RecordFileHandle::ReadRecord(const REM_RecordID&, REM_RecordHandle&) const':
REM/REM_RecordFileHandle.cpp:35: error: passing 'const STORM_FileHandle' as 'this' argument of 't_rc STORM_FileHandle::GetPage(int, STORM_PageHandle&)' discards qualifiers
I use the sfh like this:
rc = sfh.GetPage(currentPageID,mph);
where currentPageID is int and mph is STORM_PageHandle object;
rc is a return code class.
Can anyone explain me how could i use the sfh object?Thanks in advance
Non-const member functions (in this case, STORM_FileHandle::GetPage()) can only receive non-const this parameters. Either change the type of the parameter to non-const or change the member function to const.
I don't pass any const parameter on GetPage().GetPage is set as: t_rc STORM_FileHandle::GetPage(int& pageID,STORM_PageHandle& sph);currentPageID is int currentPageID; and mph is STORM_PageHandle mph;.I don't have any const variable to pass it as parameter.And unfortunately i can't change the member function.I am not allowed.