A

Admin • 833K Points
Coach

Q. What is the output of the following C++ program?

Code:
#include<iostream>
using namespace std;

class MyClass {
int val;
public:
MyClass(int v);
};

MyClass::MyClass(int v) {
val = v;
cout << "Constructor called
";
}

int main() {
MyClass arr[100];
return 0;
}
  • (A) Display “Constructor called”
  • (B) Does not display anything
  • (C) Compilation error
  • (D) None of the above
  • Correct Answer - Option(C)
  • Views: 22
  • Filed under category C++
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.