1.

What is the output of this program?
#include <iostream>
using namespace std;
class Example
{
private:
int* K;
int L;
public:
Example (int L);
~Example ();
int& operator [] (int num);
};
int& Example::operator [] (int num)
{
return K[num];
}
Example::Example (int L)
{
K = new int [L];
L = L;
}
Example::~Example ()
{
delete [] K;
}
int main ()
{
Example obj (10);
obj [0] = 15;
obj [1] = 10;
obj [2] = 35;
obj [3] = 30;
for (int num = 0; num < 5; ++ num)
cout << obj [num] < return 0;
}

A. 15 10 0 30 35
B. 35 30 15 10 0
C. 0 10 15 30 35
D. 0 15 10 35 30
E. 15 10 35 30 0
Answer» F.


Discussion

No Comment Found

Related MCQs