|
Go backward to Type Constructors Go up to RT++ Type Declarations Go forward to Template Types |
|
class Int
{
int sign;
Array<unsigned long> digits;
public:
...
void init(void)
{
digits.init();
}
void scan(void)
{
digits.scan();
}
}
Since the digits component uses the RT++ type
Array, the member functions
init and scan must call the corresponding
counterparts of digits.
In order to use a variable
we have to provide in one C++ source code file the global declarationsList<Int> l;
(sinceAtom(unsigned long); Ref(Int);
unsigned long is used in Int as the base type of
Array and Int is used as the base type of
List).
If none of the C++ object files contains an Atom or Int
declaration for a type T which is used as the base type of an RT++ type
constructor, the linker complains with an error message similar to the
following:
prog.o(.text+0x7b8): undefined reference to `Type<T>::init' prog.o(.text+0x834): undefined reference to `Type<T>::scan'