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.

Computer Science & Information Technology

You might also like to view...

Critical Thinking QuestionsCase 6-1Bev has organized her thoughts and ideas for her new human resources presentation in a rough sketch outline document. At lunch today, she asks if you have any tips on a quick way to get from her sketch outline to a PowerPoint presentation. Next you suggest that Bev ____. a. print her formal outline and use it as a guide for creating her new slidesc. copy and paste the formal outline's first, second, and third level paragraphs into individual slidesb. open her formal outline in PowerPoint using the All Outlines option to add slides based on the outline to her new presentationd. hire someone to create her presentation

What will be an ideal response?

Computer Science & Information Technology

____ ppi is an acceptable resolution if your image will appear in black and white in a newspaper.

a. 72 b. 150 c. 240 d. 300

Computer Science & Information Technology

How should organizations cope with proxy server slowdown?

A. Use a different proxy server product. B. Add multiple proxy servers to the same network connection. C. Add multiple network connections for the same proxy server. D. Buy additional hardware.

Computer Science & Information Technology

Today's mobile phones and some PCs use a touch user interface called a _____ to allow people to control the personal computer.

A. multiprocessing user interface B. command-based user interface C. speech recognition user interface D. natural user interface

Computer Science & Information Technology