Go backward to Representation
Go up to Pointers
Go forward to Allocation

Definition

Pointer<T> p
Pointer<T> p(1)

Specification: Defines a pointer p.

  1. In the first form, p may refer to any object of type T. p does not yet refer to any object.
  2. In the second form, p is bound to a new memory block that may hold any T object. The memory block does not yet hold any T object.
Constraint: It is syntactically possible but illegal to define for n != 0
Pointer<T> p(n)
Note: The second form is equivalent to 
Pointer<T> p
p.alloc()
which is in turn equivalent to but more efficient than 
Pointer<T> p
p = Pointer<T>::Alloc()

Wolfgang.Schreiner@risc.uni-linz.ac.at
Id: main.tex,v 1.10 1996/04/04 11:45:47 schreine Exp

Prev Up Next