Why is there a compile error here?
Course: https://www.educative.io/courses/learn-object-oriented-programming-in-cpp
Lesson: Quiz - Learn Object-Oriented Programming in C++
Why is there a compile error here?
Course: https://www.educative.io/courses/learn-object-oriented-programming-in-cpp
Lesson: Quiz - Learn Object-Oriented Programming in C++
num
is declared as a private variable in the Score
class. In the main, we are trying to access the num
, but since it’s a private variable in the Score
class, we cannot access it, which results in a compiler error.