BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

forward declaration problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Mar 31, 2006 10:03 am    Post subject: forward declaration problem Reply with quote



Hi, I'm having a small problem with forward declaration. Am I doing
something wrong? Please HELP ;)

compiler output:
Build
[C++ Error] Unit1.cpp(31): E2029 'Regula' must be a previously
defined class or struct
[C++ Error] Unit1.cpp(44): E2034 Cannot convert 'RegulaPliku *' to
'Regula *'


class RegulaPliku;
class Regula;


class RegulaPliku : Regula
{
public:
char nazwa[256];
int rozmiar;
};

class Regula
{
public:
int typ;

static Regula wczytajRegule()
{
Regula *r = new RegulaPliku();
return *r;
}
};



class OpisAplikacji
{
public:
char nazwa[256];
char wersja[64];
int liczba_regul;
vector<Regula> reguly;

void wczytaj(FILE* plik)
{
fread(nazwa,sizeof(nazwa),1,plik);
fread(wersja,sizeof(wersja),1,plik);
fread(&liczba_regul,sizeof(liczba_regul),1,plik);
reguly.clear();
for ( int i = 0 ; i < liczba_regul ; i++)
reguly.push_back(Regula::wczytajRegule());
}
};

class OpisyAplikacji
{
public:
vector<OpisAplikacji> opisy;

bool wczytaj(AnsiString nazwa_pliku)
{
FILE* plik = fopen(nazwa_pliku.c_str(),"rb");
if (plik == NULL)
return false;
int rozmiar_pliku = fseek(plik,0,SEEK_END);
fseek(plik,0,SEEK_SET);

while (fseek(plik,0,SEEK_SET) < rozmiar_pliku)
{
OpisAplikacji *oa = new OpisAplikacji();
oa->wczytaj(plik);
}

fclose(plik);
return true;
}

};
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.