hi
I have 2 files, the first one has class name pDisk
the second one has a class caled pFileTable : public pDisk
Please tell me what is wrong with my code:
here is the two classes
from File name : pDiskFile.h
Code:
#ifndef P_DISK_FILE_H
#define P_DISK_FILE_H
#include <sstream>
#include <vector>
#include <string>
#include <strstream>
#include <iostream>
#include <cstdlib>
//#include <stdlib>
#include <iomanip>
#include <cmath>
#include <math.h>
#include <time.h>
#include "utilities.h"
#include "fileTable.h"
//fstream pDISK;
class pDisk
{
public:
int fDisk(int number_Of_Blocks, int block_Size, string p_Disk_Name); // initialize disk
int fsCreate(string p_Disk_Name); // creats the disk after the initialization and formats disk file with filesystem
int fsOpen(string p_Disk_Name); // reads file system into into memory for manipulation and whatever...!
int synch(); // synch memory data to disk file
int addBlock(string file_Name, string buffer); // add block to file with content of buffer
int delBlock(string file_Name, int block_Number); // delete block if in file
int firstBlock(string file_Name); // return first block in file
int nextBlock(string file_Name, int block_Number);// get next block in file
int getBlock(string file_Name, int block_Number, string &buffer); // get buffer from block if in file
void printDISK();// print the information from the disk to the screen
string getPhysicalBlock( string file_Name, int block_Number, string & buffer);
// this will get the blockSize and store it into a buffer.
/* dealing with files in the disk
these was eliminated after the second phase as we made a lot of changes in the
file table and we don't have the time to finish them
to be done later...
*/
int findBlock(string file_Name, int block_Number); // Find the Block in the File_name from the Block_Number
int addFile( string file_Name, string fileBuffer); // add the name of the file to thr root and the file buffer to the disk
int delFile( string file_Name); // Dellet a file from the disk
int filePos(string p_Disk_Name); //it takes the file name and return it position in the vROOT vector.
private:
int numberOfBlocks; // number of blocks in pdisk
int blockSize; // number of bytes per block
int fatSize; // FAT size in blocks
string pDiskName; // name of pdisk for file system
int totalBlocks; // will have the number of the total blocks
string dataBLOCKS; // will have all the blocks buffer as one string
vector <int> vFAT; // memory storage for FAT information
//vector <Pair> vROOT; // memory storage for root information
vector <int> vROOT; // memory storage for root information
vector <string> vFileName;// the file Names in the root
//vector <Pair> vBUFFER; // memory storage:Buffer of the disk, and the block number
};// end of Class PDisk.
the second class is from file : fileTable.h
Code:
#ifndef __FILE_TABLE_H
#define __FILE_TABLE_H
#include <sstream>
#include <vector>
#include <string>
#include <strstream>
#include <iostream>
#include <cstdlib>
//#include <stdlib>
#include <iomanip>
#include <cmath>
#include <math.h>
#include <time.h>
#include "pDiskFile.h"
#include "utilities.h"
string flat_File;
int headerBlock;
class FileTable: public pDisk // OOP //^^^^^^^^^^^line34^^^
{
public:
FileTable();
FileTable(string flat_File);
int buildFile( string input_File);
int addRecord( string record, string buffer);
string searchBlock( string block, int key, string value);
int searchAll( string value);
int Search( string key, string value, int feild);
int fieldQuery( string qur, int field);
void display( string find, int flag);
void Cat();
int lookUp();
string pack( vector<string> discr, vector<int> links);
void unpack(string buffer, vector<string>& discR, vector<int> links);
// from part III
int buildRoot( vector<string> key, vector<int> blocks); // build the Tree root.
int bTreeSearch( int node, string key);// Search the tree for a key.
int addBTree( int node, string & key, int& block); // add a new key to the tree
int EXTERInsert( int node, string key, int block, string & median, int & new_Block);
int INTERinsert( int node, string key, int block, string & median, int & newBlock);
int extDelete( int node, string key);
int buildKeys( string input_File); // build the keys of the tree
void metaFile( string block, int location);// the file
void buildNewRoot( string median, int leftChild, int rightChild);
int fixChild(int child, int sibling, string & median);
private:
pDisk pTableDISK; //************here is the problem**********//
fstream fileName;
};// Class FileTable
the error is
fileTable.h:34: syntax error before `;'
fileTable.h:37: parse error before `{'
fileTable.h:40: parse error before `)'
fileTable.h:69: parse error before `private'
fileTable.h:79: invalid use of undefined type `class FileTable'
fileTable.h:36: forward declaration of `class FileTable'
Please , I am about to give up:

.... all the errors that I have in my code is "the second class can't make a variable from the first class. I don't know why....
Thanx a lot