titanandrews
Programmer
In "Practical C++ Programming" they show you how to initialize a constant in the constructor. What they don't say is how to initialize more than one constant. Can someone please provide an example of how this is done given the following code?
Compiler complains that anInt2 is not initialized.
Thanks for your help!
Barry
Code:
class MyClass
{
private:
const int anInt;
const int anInt2;
public:
MyClass::MyClass();
};
MyClass::MyClass() : anInt(1)
{
}
Compiler complains that anInt2 is not initialized.
Thanks for your help!
Barry