Question
#include <iostream>
using namespace std;
class Base1
{
protected:
int SampleDataOne;
public:
Base1()
{
SampleDataOne = 100;
}
~Base1()
{
}
int SampleFunctOne()
{
return SampleDataOne;
}
};
class Base2
{
protected:
int SampleDataTwo;
public:
Base2()
{
SampleDataTwo = 200;
}
~Base2()
{
}
int SampleFunctTwo()
{
return SampleDataTwo;
}
};
class Derived1 : public Base1, public Base2
{
int MyData;
public:
Derived1()
{
MyData = 300;
}
~Derived1()
{
}
int MyFunct()
{
return (MyData + SampleDataOne + SampleDataTwo);
}
};
int main()
{
Base1 SampleObjOne;
Base2 SampleObjTwo;
Derived1 SampleObjThree;
cout << SampleObjThree.Base1 :: SampleFunctOne() << endl;
cout << SampleObjThree.Base2 :: SampleFunctTwo() << endl;
return 0;
}
a.
100
b.
200
c.
Both 100 & 200
d.
None of the mentioned
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which design patterns benefit from the multiple inheritance?
View solution
Q. What are the things are inherited from the base class?
View solution
Q. How many access specifiers are there in c++?
View solution
Q. What of the following describes protected access specifier?
View solution
Q. To which of the following access aspecifiers are applicable?
View solution
Q. What is the default access level to a block of data?
View solution
Q. What is the importance of mutable keyword?
View solution
Q. What is the Run-Time Type Information?
View solution
Q. Which operators are part of RTTI?
View solution
Q. To which type of class, We can apply RTTI?
View solution
Q. What is meant by type_info?
View solution
Q. At which time does the static_cast can be applied?
View solution
Q. Which is referred by pointers to member?
View solution
Q. What should be used to point to a static class member?
View solution
Q. Which operator is used in pointer to member function?
View solution
Q. Which is the best design choice for using pointer to member function?
View solution
Q. What is the operation for .*?
View solution
Q. Which is used to allocate and deallocate storage for objects during the execution?
View solution
Q. Which operators are used in the free store?
View solution
Q. What type of class member is operator new?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!