Multiple choice

The following examples show that the class R id derived from classes P and Q. Which of them is/ are legal?

  1. class R : public P : public Q

  2. class R : public P, Q

  3. class R : public P, public Q

  4. class R :: public P : public Q

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

In C++, multiple inheritance is specified by listing the base classes separated by commas after the colon, with the access specifier for each.