I don't know if this is suitable to ask in here, because this question is much more specific rather than general.
I've been reading this book: OOP in C - Axel Schreiner but found that it's hard to understand.
For example, in section 1.7: An Implementation — Set
If an object stores no information and if every object belongs to at most one set, we can represent each object and each set as small, unique, positive integer values used as indices into an array heap[]. If an object is a member of a set, its array element con- tains the integer value representing the set. Objects, therefore, point to the set containing them.
alongside with
#if ! defined MANY || MANY < 1
#define MANY 10
#endif
static int heap [MANY];
void * new (const void * type, ...)
{ int * p; /* & heap[1..] */
for (p = heap + 1; p < heap + MANY; ++ p)
if (! * p)
break;
assert(p < heap + MANY);
* p = MANY;
return p;
}
I cannot connect this two together.
What does "object stores no information" mean?
What does "every object belongs to at most one set" mean?
What does "If an object is a member of a set, its array element con- tains the integer value representing the set" mean?
I read it so hard but still cannot get it. Thanks.