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...

Just like an image, charts can be resized using sizing handles

Indicate whether the statement is true or false

Computer Science & Information Technology

What is a parameter report? When would a parameter report be more useful than a regular report?

What will be an ideal response?

Computer Science & Information Technology

Which of the following is NOT a handout printing option?

A) Six B) Two C) All D) One

Computer Science & Information Technology

A(n) ____________________ can be used to write a stream of text to a file.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology