B
Bit byte
I have a class that has a privat member which is a struct which holds
several other structs. I have 2 questions, should I declared my member
variable that stores the other structs as :
A).
struct one_way_ {
struct A a;
struct B b ;
//... etc
struct N n;
} m_priv ;
OR
====
B).
struct another_way_ {
struct A *a;
struct B *b ;
//... etc
struct N *n;
} m_priv ;
1). Are there any advantages of one over the other ?
2). If I want to write methods that populate the class (containg
m_priv), is it better to use structure defined in A or B? (Assume that
the structures in m_priv themselves are nested and contain pointers.
several other structs. I have 2 questions, should I declared my member
variable that stores the other structs as :
A).
struct one_way_ {
struct A a;
struct B b ;
//... etc
struct N n;
} m_priv ;
OR
====
B).
struct another_way_ {
struct A *a;
struct B *b ;
//... etc
struct N *n;
} m_priv ;
1). Are there any advantages of one over the other ?
2). If I want to write methods that populate the class (containg
m_priv), is it better to use structure defined in A or B? (Assume that
the structures in m_priv themselves are nested and contain pointers.