I'm fairly new to c++ coming from c, so I'm a little confused.
I have the following:
Page *pageTable;
Desc *descTable;
pageTable = new Page[100]; //array of Page objects
descTable = new Desc[100]; //array of Desc objects
Later on I have the following for loop:
for(i=0;i<100;i ++)
{
if(descTable[i].valid==true)
{
(descTable[i].file)->writePage(page Table[i].pageNo,descTab le[i]);
}
}
The Desc class has a (bool valid) and (int pageNo) and (File* file).
The file method writePage is defined as:
writePage(int pageNo, Page* pagePtr);
When I try to compile this, I get the following error:
error: no matching function for call to `File::writePag e(int&, Page&)'
error: candidates are: const Status File::writePage (int, Page*)
I just can't seem to figure out the correct way to pass around the
pointers. If I need to change something I'd like it to be the code
here, not the member functions of File.
Anyone have any ideas? This has been driving me crazy! Thanks!
I have the following:
Page *pageTable;
Desc *descTable;
pageTable = new Page[100]; //array of Page objects
descTable = new Desc[100]; //array of Desc objects
Later on I have the following for loop:
for(i=0;i<100;i ++)
{
if(descTable[i].valid==true)
{
(descTable[i].file)->writePage(page Table[i].pageNo,descTab le[i]);
}
}
The Desc class has a (bool valid) and (int pageNo) and (File* file).
The file method writePage is defined as:
writePage(int pageNo, Page* pagePtr);
When I try to compile this, I get the following error:
error: no matching function for call to `File::writePag e(int&, Page&)'
error: candidates are: const Status File::writePage (int, Page*)
I just can't seem to figure out the correct way to pass around the
pointers. If I need to change something I'd like it to be the code
here, not the member functions of File.
Anyone have any ideas? This has been driving me crazy! Thanks!
Comment