1.

What is the output of this program?
#include <iostream>
using namespace std;
class BoxExample
{
double W;
public:
friend void printW(BoxExample box );
void setW( double width );
};
void BoxExample::setW( double width )
{
W = width;
}
void printW(BoxExample box )
{
box.W = box.W * 3;
cout << "Width of box : " << box.W << endl;
}
int main( )
{
BoxExample box;
box.setW(15.0);
printW( box );
return 0;
}

A. 15
B. 3
C. 45
D. Compilation Error
E. None of these
Answer» D. Compilation Error


Discussion

No Comment Found

Related MCQs