next up previous
Next: Destructors Up: Proposal for scanner output Previous: Class Declarations

Constructors

Each construcator needs to have a redirector and an externally linked function tag

Each constructor generates a file scope level call to GENERATE_EXTERN_CONSTRUCTOR_N

For class Example [ better to chose a different name ]

constructor

Example(int i, Example e)
{
// stuff in constructor
}

becomes

Example(int i, Example e, DEFAULT_CONSTRUCTOR_ARGS)
{
   REDIRECT_CONSTRUCTOR_2(Example, unique_symbol, int, i, Example, e)
// stuff inside constructor.
}

with at file scope

GENERATE_EXTERN_CONSTRUCTOR_2(Example, unique_symbol, int, Example)

NOTE: must be careful to deal correctly with initializer lists.



Jonathan Poole
Mon May 22 17:15:50 BST 1995