Multiple choice

Consider the following program & name the base class & the derived class. #include class A { int a; public: void getdata(); void putdata(); }; class B { int b; public: void cal(); }; class C: public A,B { public: void show(); };

  1. Base class-B Derived class-C

  2. Base class-A & B Derived class-C

  3. Base class-A Derived class-B & C

  4. Base class-A Derived class-C

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

Class C uses multiple inheritance, inheriting from both class A and class B (syntax: class C: public A,B). This makes A and B the base classes and C the derived class. Multiple inheritance allows a class to inherit from multiple base classes simultaneously.