Analyze the following code:
```
#include
using namespace std;
class Date
{
friend void p();
private:
int year;
int month;
int day;
};
void p()
{
Date date;
date.year = 2000;
cout << date.year;
}
int main()
{
p();
return 0;
}
```
A. The program compiles and runs fine and display 2000.
B. Since year is private, you cannot access it using date.year in function p().
C. The program has a syntax error because year is a private data field in Date.
D. The program will have a syntax error if the line friend void p() is deleted.
A. The program compiles and runs fine and display 2000.
D. The program will have a syntax error if the line friend void p() is deleted.
You might also like to view...
A ________ is used to ensure a teleworker has access to needed company data by utilizing encryption techniques to establish a secure connection between the worker's home computer and the company's server
A) PBX B) LAN C) GSA D) VPN
Which of the following statements would display the phase Java is fun?
a. System.out.println("hellois fun\rJava "); b. System.out.println('Java is fun'); c. System.out.println("\"Java is fun\""); d. System.out.println(Java is fun);