..
  NOTE: This RST file was generated by `make examples`.
  Do not edit it directly.
  See docs/source/examples/example_doc_generator.py

.. _ex-composition:

Composition Example
===============================================================================

 Demonstrate the use of Compostion of Atom objects.

1. If the class has not been declared, use a ForwardTyped
   - Note the use of lambda, because "Person" is not yet defined

2. A Typed object can be instantiated three ways:
   - Provide args, kwargs, or a factory in the definition
   - Provide a _default_* static constructor
   - Provide a pre-created object in the constructor

.. TIP:: To see this example in action, download it from
 :download:`composition <../../../examples/api/composition.py>`
 and run::

   $ python composition.py

Example Atom Code
-------------------------------------------------------------------------------
.. literalinclude:: ../../../examples/api/composition.py
    :language: python
