Выдает такие ошыбки:
[C++ Error] Adress.h(5): E2238 Multiple declaration for 'Adress'
[C++ Error] Adress.h(4): E2344 Earlier declaration of 'Adress'
[C++ Error] AdressBook.h(4): E2238 Multiple declaration for 'AdressBook'
[C++ Error] AdressBook.h(4): E2344 Earlier declaration of 'AdressBook'
в хедерах:
Code
#include <vcl.h>
#include <Grids.hpp>
class Adress
{
protected:
AnsiString cyti;
AnsiString street;
AnsiString numerHous;
unsigned short int numerFlat;
public:
Adress();
Adress(AnsiString Cyti, AnsiString Street, AnsiString NumerHous, unsigned short int NumerFlat);
Adress(const Adress &adress);
void setCyti(AnsiString Cyti){cyti=Cyti;};
void setSteet(AnsiString Street){street=Street;};
void setNumerHous(AnsiString NumerHous){numerHous=NumerHous;};
void setNumerFlat(unsigned short int NumerFlat){numerFlat=NumerFlat;};
AnsiString getCyti(){return cyti;};
AnsiString getSteet(){ return street;};
AnsiString getNumerHous(){return numerHous;};
unsigned short int getNumerFlat(){ return numerFlat;};
void print(TStringGrid *st);
~Adress(){};
};
Code
#include <vcl.h>
#include "Adress.h"
class AdressBook:public Adress
{
protected:
AnsiString name;
public:
AdressBook();
AdressBook(AnsiString Name,
AnsiString Cyti,
AnsiString Street,
AnsiString NumerHous,
unsigned short int NumerFlat);
AdressBook(const AdressBook &aBook);
AdressBook(const AdressBook *aBook);
void setName(AnsiString Name){name=Name;};
AnsiString getName(){return name;};
void print(TStringGrid *st);
};
Ети классы использую здесь:
Code
#include "ArrayAdressBook.h"
ArrayAdressBook::ArrayAdressBook()
{
list=new TList();
}
void ArrayAdressBook::Add(AdressBook *aBook)
{
list->Add(aBook);
}
void ArrayAdressBook::printList(TStringGrid *st)
{
for (int i=0;i<list->Count;i++)
{
AdressBook aBook((AdressBook)list->Items[i]);
aBook.print(st);
}
}