Suppose we write a class and declare an object of this class in main. What happens if we use the object to call a private member function? Explain.

What will be an ideal response?

If I create an object in main, such as my Date object, i.e., Date myDate; and then attempt to access the private Date data, such as the month or year, like this: myDate.month or myDate.year, the compile will stop me and issue an error. Private data is not accessible to the world via the object.

Computer Science & Information Technology

You might also like to view...

In the bottom section of the Microsoft Office 365 Admin Welcome screen, the ________ link tracks service health and maintenance

A) licenses B) service status C) support D) service settings

Computer Science & Information Technology

Repetition structures use accumulator variables to tally information such as the total dollar amount of a week's payroll.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology