summaryrefslogtreecommitdiff
path: root/reference/CPLUSPLUS/SYNTAX/enum.html
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2008-01-27 11:37:44 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2008-01-27 11:37:44 +0100
commit7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch)
treeb1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/CPLUSPLUS/SYNTAX/enum.html
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/CPLUSPLUS/SYNTAX/enum.html')
-rw-r--r--reference/CPLUSPLUS/SYNTAX/enum.html110
1 files changed, 110 insertions, 0 deletions
diff --git a/reference/CPLUSPLUS/SYNTAX/enum.html b/reference/CPLUSPLUS/SYNTAX/enum.html
new file mode 100644
index 0000000..0f48a16
--- /dev/null
+++ b/reference/CPLUSPLUS/SYNTAX/enum.html
@@ -0,0 +1,110 @@
+<HTML>
+<HEAD>
+ <TITLE>ENUM keyword</TITLE>
+</HEAD>
+
+<BODY BGCOLOR="#DDDDDD">
+
+<HR>
+<CENTER>
+<H1>
+<FONT COLOR="#A52A2A">C++ changes to ENUM.</FONT>
+</H1>
+</CENTER>
+
+<HR>
+
+<P><FONT COLOR="#A52A2A">In the C++ world, the rules applying to
+<B>enum</B> have been altered.
+
+<ul>
+<li>Definitions no longer require the enum prefix or a
+<a href=../../C/SYNTAX/typedef.html>typedef</a> fudge.
+</ul>
+<CENTER><TABLE BORDER=0 COLS=1 WIDTH="80%" BGCOLOR="ivory" >
+<TR>
+<TD>
+<pre>
+
+ main ()
+ {
+ enum Currancy = {STERLING, DOLLAR, RUPEE};
+
+ enum Currancy GreenBack = DOLLAR; // Valid in C and C++
+ Currancy Pounds = STERLING; // Valid in C++ only.
+
+ }
+</pre>
+</TD>
+</TR>
+</TABLE></CENTER>
+
+
+
+<UL>
+<LI>
+<FONT COLOR="#A52A2A">An <B>enum</B> is no longer considered to be an int
+datatype. Because it has its own datatype you can not perform normal arithmatic
+apon <B>enum</B> variables. The following program is now invalid.</FONT></LI>
+</UL>
+<CENTER><TABLE BORDER=0 COLS=1 WIDTH="80%" BGCOLOR="ivory" >
+<TR>
+<TD>
+<pre>
+
+ main ()
+ {
+ enum Currancy = {STERLING, DOLLAR, RUPEE};
+
+ Currancy Pounds = STERLING;
+
+ Pounds = 2; // Invalid Statement.
+
+ Pounds++; // Invalid Statement.
+ }
+</pre>
+</TD>
+</TR>
+</TABLE></CENTER>
+
+<P>
+<HR>
+<H2>
+<FONT COLOR="#A52A2A">Examples:</FONT></H2>
+<IMG SRC="../../GRAPHICS/computer.gif" ALT="o" ><FONT COLOR="#A52A2A"> <A HREF="../EXAMPLES/enum1.cc">Example
+program.</A>&nbsp;</FONT>&nbsp;
+<HR>
+<H2>
+<FONT COLOR="#A52A2A">See Also:</FONT></H2>
+
+<HR>
+<H2>
+<FONT COLOR="#000000">C References</FONT></H2>
+<IMG SRC="../../GRAPHICS/whiteball.gif" ALT="o"><FONT COLOR="#000000"> <A HREF="../../C/SYNTAX/enum.html">C
+version of <B>enum</B>.</A></FONT>
+
+<P>
+<hr>
+<center>
+<table border=2 width="80%" bgcolor="ivory">
+<tr align=center>
+<td width="25%">
+<a href="../cref.html">Top</a>
+</td><td width="25%">
+<a href="../../C/master_index.html">Master Index</a>
+</td><td width="25%">
+<a href="keywords.html">C++ Keywords</a>
+</td><td width="25%">
+<a href="../../C/FUNCTIONS/funcref.htm">Functions</a>
+</td>
+</tr>
+</table>
+</center>
+<p>
+<hr>
+<font color=brown>
+<address>Martin Leslie
+25-Oct-98</address><p>
+
+</BODY>
+</HTML>