1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>BoostBook element class</title> 6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="../../reference.html" title="Reference"> 10<link rel="prev" href="access.html" title="BoostBook element access"> 11<link rel="next" href="librarycategorydef.html" title="BoostBook element librarycategorydef"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 16<td align="center"><a href="../../../../index.html">Home</a></td> 17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="access.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="librarycategorydef.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="boostbook.dtd.class"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle"> 30 BoostBook element <code class="sgmltag-element">class</code></span></h2> 31<p>class — Declares a class or class template</p> 32</div> 33<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 34<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv">class ::= 35 (<a class="link" href="template.html" title="BoostBook element template">template</a>?, <a class="link" href="inherit.html" title="BoostBook element inherit">inherit</a>*, <a class="link" href="purpose.html" title="BoostBook element purpose">purpose</a>?, <a class="link" href="description.html" title="BoostBook element description">description</a>?, (<a class="link" href="access.html" title="BoostBook element access">access</a>| <a class="link" href="static-constant.html" title="BoostBook element static-constant">static-constant</a>| <a class="link" href="typedef.html" title="BoostBook element typedef">typedef</a>| <a class="link" href="enum.html" title="BoostBook element enum">enum</a>| <a class="link" href="copy-assignment.html" title="BoostBook element copy-assignment">copy-assignment</a>| <a class="link" href="constructor.html" title="BoostBook element constructor">constructor</a>| <a class="link" href="destructor.html" title="BoostBook element destructor">destructor</a>| <a class="link" href="method-group.html" title="BoostBook element method-group">method-group</a>| <a class="link" href="free-function-group.html" title="BoostBook element free-function-group">free-function-group</a>| <a class="link" href="function.html" title="BoostBook element function">function</a>| <a class="link" href="method.html" title="BoostBook element method">method</a>| <a class="link" href="overloaded-function.html" title="BoostBook element overloaded-function">overloaded-function</a>| <a class="link" href="overloaded-method.html" title="BoostBook element overloaded-method">overloaded-method</a>| <a class="link" href="data-member.html" title="BoostBook element data-member">data-member</a>| <a class="link" href="class.html" title="BoostBook element class">class</a>| <a class="link" href="class-specialization.html" title="BoostBook element class-specialization">class-specialization</a>| <a class="link" href="struct.html" title="BoostBook element struct">struct</a>| <a class="link" href="struct-specialization.html" title="BoostBook element struct-specialization">struct-specialization</a>| <a class="link" href="union.html" title="BoostBook element union">union</a>| <a class="link" href="union-specialization.html" title="BoostBook element union-specialization">union-specialization</a>)*) 36</div> 37<div class="refsection"> 38<a name="id-1.4.3.7.56.4"></a><h2>Description</h2> 39<p>C++ classes and class templates are described via the 40 <class> element. Each class has a name (e.g., "any") given by 41 the <code class="computeroutput">name</code> attribute, a purpose given by the 42 <purpose> element, documentation, and a set of types, 43 functions, base classes, and data members. Here is a minimal 44 definition of the <code class="computeroutput"><a class="link" href="../../boost/any.html" title="Class any">boost::any</a></code> class:</p> 45<pre class="programlisting"><namespace name="boost"> 46 <class name="any"> 47 <purpose> 48 A class whose instances can hold instances of any type that satisfies 49 ValueType requirements. 50 </purpose> 51 </class> 52</namespace></pre> 53<p>Additional class documentation can be contained in a 54 <code class="sgmltag-element">description</code> element following the <purpose> 55 element. This documentation will be typeset prior to documentation 56 for specific elements in the class (e.g., constructors or 57 methods).</p> 58<p>Class inheritance is described via the <inherit> 59 element. The <inherit> element requires an <code class="computeroutput">access</code> 60 attribute which must be one of <span class="emphasis"><em>public</em></span>, 61 <span class="emphasis"><em>protected</em></span>, or <span class="emphasis"><em>private</em></span>. The 62 content of the <inherited> element in C++ code that names the 63 class inherited, and may contain markup to link to the class. The 64 following description of the class 65 <code class="computeroutput"><a class="link" href="../../boost/bad_any_cast.html" title="Class bad_any_cast">boost::bad_any_cast</a></code> describes public 66 inheritance from the class <code class="computeroutput">std::bad_cast</code>. It 67 also defines the <purpose> element, which contains a short 68 description of the use of the class.</p> 69<pre class="programlisting"><class name="bad_any_cast"> 70 <inherit access="public"><classname>std::bad_cast</classname></inherit> 71 <purpose><para>The exception thrown in the event of a failed 72 <functionname>any_cast</functionname> of an 73 <classname>any</classname> value.</para></purpose> 74</class></pre> 75<p>Class templates are defined by <class> elements with a 76 <template> child element at the beginning.</p> 77</div> 78<div class="refsection"> 79<a name="id-1.4.3.7.56.5"></a><h2>Attributes</h2> 80<div class="informaltable"><table class="table"> 81<colgroup> 82<col> 83<col> 84<col> 85<col> 86</colgroup> 87<thead><tr> 88<th>Name</th> 89<th>Type</th> 90<th>Value</th> 91<th>Purpose</th> 92</tr></thead> 93<tbody> 94<tr> 95<td>last-revision</td> 96<td>#IMPLIED</td> 97<td>CDATA</td> 98<td>Set to $Date$ to keep "last revised" information in sync with CVS changes</td> 99</tr> 100<tr> 101<td>name</td> 102<td>#REQUIRED</td> 103<td>CDATA</td> 104<td>The name of the element being declared to referenced</td> 105</tr> 106<tr> 107<td>id</td> 108<td>#IMPLIED</td> 109<td>CDATA</td> 110<td>A global identifier for this element</td> 111</tr> 112<tr> 113<td>xml:base</td> 114<td>#IMPLIED</td> 115<td>CDATA</td> 116<td>Implementation detail used by XIncludes</td> 117</tr> 118</tbody> 119</table></div> 120</div> 121</div> 122<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 123<td align="left"></td> 124<td align="right"><div class="copyright-footer">Copyright © 2003-2005 Douglas Gregor<p>Distributed under the Boost Software License, Version 1.0. 125 (See accompanying file LICENSE_1_0.txt or copy at 126 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>). 127 </p> 128</div></td> 129</tr></table> 130<hr> 131<div class="spirit-nav"> 132<a accesskey="p" href="access.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="librarycategorydef.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 133</div> 134</body> 135</html> 136