Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! I am working on a class in C++, and one of its private members is : char answer { ' a ' };. Whenever
Hello! I am working on a class in C++, and one of its private members is : char answer { ' a ' };.
Whenever I try to compile, Visual Studio throws a C2397 error stating that conversion from int to char requires narrowing conversion.
Why is this occurring? Wouldn't ' a ' be considered a char?
As a note: The program compiled fine about ten minutes before these errors occurred. This was after changing the ' a ' from its original value of ' + ', as the + was causing the same compilation error..
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started