I am attempting to port a program written in C to C++.
For the most part it is fairly straight forward, however I have this particular problem that I just cannot get my head round.
It's our good old friend a Struct and an Array of said Struct.
As in :-
struct record {
char name[22];
int pos;
secondName;
float scale;
} arrayOfStruct[] = {"Diddy Dum" , 0, "Diddy Dee", 1.0},/.................etc.............../
From all that I know and the many readings I should be able to and indeed can declare a class in place of the Struct :-
class record
{
public:
record(const char *, int, const char *, double);
const char *name;
int pos;
const char *otherName;
double scale;
};
And Declare a class containing the record class :-
class format
{
public:
format();
record format[256];
void setArray();
public:
};
How do I intialize the record format array to contain the the data from the Struct or the other way round. I am doing my head in with this.
Any help will be appreciated. I will keep on googling for an answer in the mean time. Thank you.