Given the program, which of the following class member accesses are legal?

```
#include using namespace std;class
DayOfYear{public: void input(); void output();//
other public members private: int month; int day;
// other private members
};int main(){
DayOfYear birthDay;
birthDay.input(); // a)
birthDay.day = 25; // b)
cout << birthDay.month; // c)
cout << birthDay.output(); // d)
if(birthDay.month == 1) // e)
cout << "January\n";
```
What will be an ideal response?


```
Error b): 'DayOfYear::day' is not
accessible in function main()
Error c): 'DayOfYear::month' is not
accessible in function main()
Error e): 'DayOfYear::month' is not
accessible in function main() The declaration of birthDay as a DayOfYear object is OK. a)
and d) are accesses to a public input and output functions. b) attempts to write a
private member, c) and e) attempt to fetch a value from a private member
month. In d), output is public, so d) is OK
```

Computer Science & Information Technology

You might also like to view...

A(n) ________ is best used for providing services that bring together objects of otherwise unrelated classes.

a) abstract class b) concrete class c) interface d) None of the above.

Computer Science & Information Technology

Discuss the relationship between data warehousing and OLAP.

What will be an ideal response?

Computer Science & Information Technology

In a slide using Title and Content layout, press ________ to move the insertion point from the title placeholder to the text placeholder

A) Alt + Tab B) Ctrl + Tab C) Ctrl + Enter D) Alt + Enter

Computer Science & Information Technology

Which of the following is not a strategy to prolong the life of IPv4?

a. NAT/PAT b. DHCP c. CIDR d. All the above are strategies

Computer Science & Information Technology