Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!wuarchive!uunet!comp.vuw.ac.nz!am.dsir.govt.nz!marcamd!mercury!kcbbs!kc From: Chris_Sullivan@kcbbs.gen.nz (Chris Sullivan) Newsgroups: comp.lang.c++ Subject: const in a class Message-ID: <1991Jun15.014436.10060@kcbbs.gen.nz> Date: 15 Jun 91 01:44:36 GMT Lines: 17 Organisation: Kappa Crucis Unix BBS, Auckland, New Zealand I want to be able to declare a local constant in a class ie a constant wgose scope is restricted to the class. This prevents any problems with a constant of the same name having scope outside the class. I tried something like the following but Zortech and Turbo C++ don't appear to accept const in a class :- class C { const int size = 1000; char array[size]; ... } In the end I had to replace the const with #define size 1000 but this changes any mainfest constant with the same name appearing outside the scope of class C. I understand that const's are preffered to #define in c++ but I can't find a way to do what I want. Any ideas anyone?