From C++ FAQs book
class Fred {
public:
Fred(int i) throw();
Fred(int i, int j) throw();
protected:
int i_;
const int j_;
};
Fred::Fred(int i) throw(): i_(i), j_(10)
<-- 1
{ }
Fred::Fred(int i, int j) throw(): i_(i), j_(j)
<-- 2
{ }
int main()
{
Fred a(5); //a.j_ will always be 10
Fred b(5,15); //b.j_ will always be 15
Fred c(5,20); //c.j_ will always be 20
}
"Angus" <no****@gmail.comwrote in message
news:en*******************@news.demon.co.uk...
Hello cppers
I am converting a Java class to C++ and have this in a Java class:
public static final int APPLICATION = 0x40;
So in my C++ class I tried:
const int APPLICATION = 0x40;
which of course gives me a C2252 compile error.
How would I create the equivalent type of constant in a C++ class?