1.

What is the output of this program?
#include <iostream>
using namespace std;
class Base
{
int K;
public:
void setInt(int num);
int getInt();
};
class Derived : public Base
{
int L;
public:
void setL(int num);
int multiply();
};
void Base::setInt(int num)
{
K = num;
}
int Base::getInt()
{
return K;
}
void Derived::setL(int num)
{
L = num;
}
int Derived::multiply()
{
return L * getInt();
}
int main()
{
Derived object;
object.setInt(12);
object.setL(3);
cout << object.multiply();
return 0;
}

A. 36
B. 12
C. 3
D. All of above
E. None of these
Answer» B. 12


Discussion

No Comment Found

Related MCQs