www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/30/00:45:10

From: cbird <cbird AT byu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: enumerated types overloading
Date: Wed, 29 Jan 1997 08:33:27 -0700
Organization: Brigham Young University
Lines: 25
Message-ID: <32EF6DC7.153A@byu.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970128122351 DOT 10987T-100000 AT is>
NNTP-Posting-Host: byu-0718.ln.byu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> enum alpha {a, b, c, d, e, f};
> 
> in my header and when I try something like:
> 
> alpha letter = a;
> a++;
> 
> I get an error saying no postincrement operator defined or something
> along those lines.

the a++ sohuld be a letter++ up there.  I accidentally mistyped it when
posting to this newsgroup (I know you can't increment a constant)  I get
an error when incrementing letter 'cause it's of type alpha and there is
no defined incrementor of that type.  My question is, how can I make it
so.  I believe it has something to do with overloading the ++ operator,
but I've never done that before in C++.  I don't know how to make an
overloaded operator.  I'm sure it can't be that hard so if anyone could
give me a simple example of it I'd be really appreciative.  When I used
BC 4.5 I guess it just treated the enumerated types as ints so
everything was honki dori.  However, while that is a plus, I still see
DJGPP as a much better compiler.  Thanx in advance to anyone with
helpful info on my problem!

Christian Bird
cbird AT byu DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019