\"\" \"\" \"\"
Go backward to Type Constructors
Go up to RT++ Type Declarations
Go forward to Template Types
RISC-Linz logo

Example

As an example, take a program that uses lists of arbitrary precision integers represented as follows:
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

List<Int> l;
we have to provide in one C++ source code file the global declarations
Atom(unsigned long); 
Ref(Int);
(since 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'

Author: Wolfgang Schreiner
Last Modification: April 12, 1997