From: kk@tansei.cc.u-tokyo.ac.jp (Ken Kawahigashi)
Newsgroups: fj.lang.c
Subject: Re: [C++]const in class
Date: 27 Aug 92 01:31:59 GMT
Distribution: fj
Organization: Computer Centre, University of Tokyo
In-reply-to: tara@ssel.toshiba.co.jp's message of 26 Aug 92 02:06:49 GMT

$B@n(J$BEl!w?@F`@nBg>pJs$G$9!#(J

$B:G6a!"3X@8$+$iF1MM$N<ALd$r<u$1$?$N$G!"%U%)%m!<$7$^$9!#(J

In article <TARA.92Aug26110649@mama.ssel.toshiba.co.jp> tara@ssel.toshiba.co.jp (Nishimura Tomoko) writes:

>$B$O$8$a$^$7$F!"(J$B@>B<(J@$BEl<G$G$9!#(J

$B$O$8$a$^$7$F(J:-)

>class $B$NCf$G!"(Jconst$B@k8@(J($BDj?t@k8@(J)$B$O$G$-$k$N$G$7$g$&$+(J?
>$BNc$($P$3$s(J$B$J$U$&$K$G$-$k$N$+$I$&$+$,!"CN$j$?$$$N$G$9!#(J
>	 class A {
>	    const b= 10;
>	      .......
>	 }

$B8=(J$B:_$NI8=`E*$J=hM}7O!J$$$o$f$k(J AT&T 2.1/3.0 $B=`5r!K$N=hM}7O$G$O(J
$B=PMh$J$$$O$:$G$9!#(J

const $B$N=i4|2=$O(J

	class A {
	   const b;
	   A() : b(10) {}
	     .......
	};


$B$N$h$&$K%3%s%9%H%i%/%?$N=i4|2=%j%9%H$G=i(J$B4|2=$7$J$1$l$P$J$j$^$;$s!#(J


$B$7$+$7!"$3$N=i4|2=K!$G$OLdBj$,$"$C$F!"$?$H$($P(J

	class Foo {
	   const SIZE;
	   int vec[SIZE];  // error
	   Foo() : SIZE(100) {}
	     .......
	};


$B$H$$$&;H$$J}$,=PMh$^$;(J$B$s!#$3$l$r2sHr$9$k<jCJ$H$7$F!"(J class local $B$J(J
enum $B$r;H$C$F!"(J

	class Foo {
	   enum {SIZE = 100};
	   int vec[SIZE];
	     .......
	};

$B$H$7$J$5$$!"$H$$$&$3$H$,$h$/K\$K=q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$B$H$G$9$+$i!"=PMh$J$$J}$,!V@5$7$$!W(J
$B$H$$$&$3$H$K$J$k$N$G$7$g$&!#(J

>#$B;d$O$F$C$-$j$G$-$k$b$N$@$H?.$8$F$$(J$B$?$N$@$1$l$I!#(J
>#$B$$$^$5$i$3$s$JC1=c$J$3$H$G$D$^$:$/$J$s$F(J...

$B$$$($$$(!"(JC++ $B$O8@8l;EMM$,$^$@40A4$K$O7h(J$B$^$j@Z$C$F$$$J$$!J$[$\8G$^$j$D$D(J
$B$"$j$^$9$,!K$N$G!"C/$b$,:.Mp$9$k$N$G$O$J$$$G$7$g$&$+!)(J

>C++$B$NC#?M$N(J$BJ}!9$,$$$C$Q$$$$$i$C$7$c$k$3$N(JNewsGroup$B$K$*$9$,$j$7$^$9!#(J
>$B$h$m$7$/$465<($*4j$$$7$^$9!#(J

$BC#?M$G$b2?$G(J$B$b$"$j$^$;$s$,!"$?$^$?$^D4$Y$?$P$+$j$N$3$H$J$N$G%U%)%m!<(J
$B$7$F$_$^$7$?!#(J

--
/*       $B@nEl(J $B7r!w>pJs2J3X(J$B2J!%M}3XIt!%?@F`@nBg3X!%J?DM%-%c%s%Q%9(J       */
/*                      ken@info.kanagawa-u.ac.jp                      */
/*                      kk@tansei.cc.u-tokyo.ac.jp                     */