Site icon T4Tutorials.com

Which symbol is used to create multiple inheritance?

Question: Which symbol is used to create multiple inheritance?
(a). Dollar symbol
(b). comma symbol
(c). Dot symbol
(d). A or b
(e).None of these

The answer of MCQs:

(b). comma symbol


Syntax of multiple inheritance in C++ OOP

class C: public A, public B

{

}

In this example, a comma is in between class A and class B.

 

C++ program in which comma symbol is used to create multiple inheritance?

#include<iostream>
using namespace std;
class A
{
protected:
int n1;
};
class B
{
protected:
int n2;
};
class C : public A, public B
{
public:
int total()
{
cout<<"Please enter the n1?"<<endl;
cin>>n1;
cout<<"Please enter the n2?"<<endl;
cin>>n2;
cout<<"sum="<<n1+n2<<endl;
}
};
int main()
{
C T4Tutorials_Object;
T4Tutorials_Object.total();
}

1000+ Programming C Plus Plus MCQs

Exit mobile version