home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_04
/
9n04074a
< prev
next >
Wrap
Text File
|
1991-02-18
|
935b
|
36 lines
/********************************************************************/
/* Boolean class. Copyright by Joe Schell 1989. */
/********************************************************************/
#ifndef CLASS_boolean
#define CLASS_boolean
const int TRUE = 1;
const int FALSE = 0;
class boolean
{
int b; // boolean type.
void value(const int i) { b = (i) ? TRUE : FALSE; }
public:
boolean() { b = FALSE; }
boolean(const int i) { value(i); }
boolean(const boolean &i) { b = i.b; }
operator int() const { return b; }
operator ~() const { return b ? FALSE : TRUE; }
boolean &operator=(const int &i) { value(i); return *this; }
boolean &operator++() { b = b ? FALSE : TRUE; return *this; }
boolean &operator--() { return (*this)++; }
char *make_string() const { return b ? "true" : "false"; }
}; // End of boolean class.
const boolean true(TRUE), false(FALSE);
#endif