Does the code contain errors that prevent the code from compiling?
class A {
  const int a;
  A() { a = 10; }
};
Explanation
constant class members must be initialized in the constructor initialization list.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes