Multiple choice

You have defined a class named Book that contains two non-static private fields, book_number and price. When you write a main () function and declare one Book object named Book1, you can display the object’s price field with the statement

  1. cout << Book.price;

  2. cout << Book(price);

  3. cout << Book1.price;

  4. cout << Book1(price);

  5. cout >> Book1.price;

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This is the correct statement to display the object’s price field.