a) If we remove the // from the line "// m = today.month;", the line becomes part of the program again. Building the program will then result in an error because the line tries to access the private member variable "month" of the class "Date".

b) To fix the error, we can change the line "private:" to "public:" in the class definition. This change will make the member variable "month" accessible from outside the class, and building the program should no longer result in an error. Changing the access specifier from "private" to "public" allows external code to access and modify the member variable "month"

Copy the program from Section 11 of the notes that includes the line m = todaymonth; -- causes an error because month is privatea remove the so that the line is part of the program again Build the

原文地址: https://www.cveoy.top/t/topic/hy6J 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录