| Home | Libraries | People | FAQ | More

## BoostBook element `class`

class — Declares a class or class template

## Synopsis

class ::= (template?, inherit*, purpose?, description?, (static-constant| typedef| enum| copy-assignment| constructor| destructor| method-group| free-function-group| function| method| overloaded-function| overloaded-method| data-member| class| class-specialization| struct| struct-specialization| union| union-specialization)*)

## Description

C++ classes and class templates are described via the <class> element. Each class has a name (e.g., "any") given by the `name` attribute, a purpose given by the <purpose> element, documentation, and a set of types, functions, base classes, and data members. Here is a minimal definition of the boost::any class:

    <namespace name="boost">
      <class name="any">
        <purpose>
          A class whose instances can hold instances of any type that satisfies
          ValueType requirements.
        </purpose>
      </class>
    </namespace>

Additional class documentation can be contained in a `description` element following the <purpose> element. This documentation will be typeset prior to documentation for specific elements in the class (e.g., constructors or methods).

Class inheritance is described via the <inherit> element. The <inherit> element requires an `access` attribute which must be one of public, protected, or private. The content of the <inherited> element in C++ code that names the class inherited, and may contain markup to link to the class. The following description of the class boost::bad_any_cast describes public inheritance from the class std::bad_cast. It also defines the <purpose> element, which contains a short description of the use of the class.

    <class name="bad_any_cast">
      <inherit access="public"><classname>std::bad_cast</classname></inherit>
      <purpose><para>The exception thrown in the event of a failed
      <functionname>any_cast</functionname> of an
      <classname>any</classname> value.</para></purpose>
    </class>

Class templates are defined by <class> elements with a <template> child element at the beginning.

## Attributes

Name | Type | Value | Purpose
--- | --- | --- | ---
last-revision | #IMPLIED | CDATA | Set to $Date: 2004/07/05 16:26:11 $ to keep "last revised" information in sync with CVS changes
name | #REQUIRED | CDATA | The name of the element being declared to referenced
id | #IMPLIED | CDATA | A global identifier for this element
xml:base | #IMPLIED | CDATA | Implementation detail used by XIncludes

| Copyright © 2003 Douglas Gregor