Hi,
Straight to the code :
///
class cBook {
public:
cBook(int NumPages, string Title, string Author) :
iNumPages(NumPages),
cTitle(Title),
cAuthor(Author)
{
};
private:
int iNumPages;
string cTitle, cAuthor;
};
class cBookShelf
{
public:
cBookShelf();
cBook &GetBook(int Index) { return Books[Index]; }
private:
static cBook Books[20];
};
cBook cBookShelf::Books[20];
///
Im not sure if this can be done : Is there a way to initialise the array of books in the cBookShelf constructor ?
i did try :
cBookShelf::cBookShelf() :
Books[0](200,"Microsoft ADO","Microsoft"
,
Books[1](500,"MSDOS Manual","Microsoft"
{
}
and i got all sorts of errors. Any ideas ?
Regards,
Rich.
Straight to the code :
///
class cBook {
public:
cBook(int NumPages, string Title, string Author) :
iNumPages(NumPages),
cTitle(Title),
cAuthor(Author)
{
};
private:
int iNumPages;
string cTitle, cAuthor;
};
class cBookShelf
{
public:
cBookShelf();
cBook &GetBook(int Index) { return Books[Index]; }
private:
static cBook Books[20];
};
cBook cBookShelf::Books[20];
///
Im not sure if this can be done : Is there a way to initialise the array of books in the cBookShelf constructor ?
i did try :
cBookShelf::cBookShelf() :
Books[0](200,"Microsoft ADO","Microsoft"
Books[1](500,"MSDOS Manual","Microsoft"
{
}
and i got all sorts of errors. Any ideas ?
Regards,
Rich.