home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!decwrl!pa.dec.com!brister
- From: brister@decwrl.dec.com (James Brister)
- Subject: consts inside a class?
- Message-ID: <BRISTER.92Sep15185309@tirade.decwrl.dec.com>
- Sender: news@PA.dec.com (News)
- Organization: DEC Western Software Lab
- Date: 15 Sep 92 18:53:09
- Lines: 34
-
- I've been putting lines like
-
- const int maxLineSize = 1024 ;
-
- in global scope, but would rather have it inside the class declaration.
- However, my compiler chokes on
-
- class A
- {
- public:
- const int foo = 10 ;
- int a ;
- };
-
- main (int argc, char **argv)
- {
- A z ;
-
- z.a = A::foo ;
- }
-
- with:
-
- test.C:4: error: Invalid pure specifier.
-
- so I suppose this way isn't legal. Is there a legal way to do this, or am I
- stuck with my current method?
-
- Thanks
-
- James
- --
- James Brister brister@wsl.pa.dec.com
- DEC Western Software Lab., Palo Alto, CA decwrl!brister
-