Question
#include<iostream.h>
static double gDouble;
static float gFloat;
static double gChar;
static double gSum = 0;
class BaseOne
{
public:
void Display(double x = 0.0, float y = 0.0, char z = 'A')
{
gDouble = x;
gFloat = y;
gChar = int(z);
gSum = gDouble + gFloat + gChar;
cout << gSum;
}
};
class BaseTwo
{
public:
void Display(int x = 1, float y = 0.0, char z = 'A')
{
gDouble = x;
gFloat = y;
gChar = int(z);
gSum = gDouble + gFloat + gChar;
cout << gSum;
}
};
class Derived : public BaseOne, BaseTwo
{
void Show()
{
cout << gSum;
}
};
int main()
{
Derived objDev;
objDev.BaseTwo::Display(10, 20, 'Z');
return 0;
}#include<iostream.h>
class Base
{
public:
int S, A, M;
Base(int x, int y)
{
S = y - y;
A = x + x;
M = x * x;
}
Base(int, int y = 'A', int z = 'B')
{
S = y;
A = y + 1 - 1;
M = z - 1;
}
void Display(void)
{
cout<< S << " " << A << " " << M << endl;
}
};
class Derived : public Base
{
int x, y, z;
public:
Derived(int xx = 65, int yy = 66, int zz = 67): Base(x)
{
x = xx;
y = yy;
z = zz;
}
void Display(int n)
{
if(n)
Base::Display();
else
cout<< x << " " << y << " " << z << endl;
}
};
int main()
{
Derived objDev;
objDev.Display(-1);
return 0;
}
a.
65 65 65
b.
65 66 67
c.
A A A
d.
A B C
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 will be the output of the following program?
Similar Questions
Discover Related MCQs
Q. The variable that are listed in the function's calls are called
View solution
Q. A programmer can create custom header files that must be end with
View solution
Q. Unary scope resolution operator is denoted by
View solution
Q. To make large programs more manageable programmers modularize them into subprograms that are called
View solution
Q. The maths function acos (x) stands for
View solution
Q. Which from the following is not a storage class specifier in C++?
View solution
Q. Which of the following function returns no value?
View solution
Q. A variable that is declared inside a block is called
View solution
Q. For accessing a global variable when a local variable of the same name is in scope, C++ provides a
View solution
Q. The () parenthesis in a function call
View solution
Q. Modules in C++ are called
View solution
Q. Which from the following is used for invoking a function?
View solution
Q. There are how many ways to invoke a function in C++?
View solution
Q. All variables declared in function definition are called
View solution
Q. Which operator is used for accessing global variables if the local variable of same name exists in the code?
View solution
Q. A function that need no return value, is called
View solution
Q. An identifier's scope is
View solution
Q. The standard C library file < stdlib.h> is used for
View solution
Q. Not initializing a reference variable will cause
View solution
Q. In which circumstances the recursion function is called?
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!
Operating System
Dive deep into the core of computers with our Operating System MCQs. Learn about...
Cyber Security
Understand the fundamentals of safeguarding digital assets with our Cyber Security...