Multiple choice

Which of the following statements is FALSE?

class base {
 public:
  void show() {}
};
class sub : private base {
 public:
  void print() {}
 protected:
  void display() {}
};
void main() { sub objs; }

  1. The object 'objs' cannot access the show() method defined in the base class.

  2. The object 'objs' can not access the display().

  3. If we declare an object of the base class, it will be able to call the 'show()' method.

  4. The object 'objs' cannot access the print() defined in the sub class.

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

The print() is declared as public in the sub class. Therefore, an object of the sub class can easily access the print() method.