I have a class and want to create a const int variable but the value for the variable is not available to me in constructor of the class.
In initialization method of the
const
doesn't mean you can only assign it once, you can never assign to a const object. A const variable is initialized once and its value cannot change. So you initialize it in the constructor, when all members and bases are initialized, then you can't change it after that.
If you can't get the value on construction you could either make the variable non-const, so you modify it, or maybe you could delay construction until you have all the data, using a placeholder until you construct the real object.
Two-stage construction is a code smell, it's certainly incompatible with const members.