Vidyalelo
C++ Programming · Q408

C++ miscellaneous

Programming · C++ Programming · question 408

Q408

What will be the output of the following C++ code? #include using namespace std; class Add int x; public: Add(int x) this->x = x; int operator()(int a) return x+a; ; int main() Add add_5(5); int a = 5; cout<<add_5(a); return 0;

A.
5
B.
10
Answer
C.
Error
D.
Segmentation fault

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board