-
What is the output of this program?
#include <iostream>
using namespace std;
class Example
{
public:
Example()
{
cout << "N::N()" << endl;
}
Example( Example const & )
{
cout << "N::N( N const & )" << endl;
}
Example& operator=( Example const & )
{
cout << "N::operator=(N const &)" << endl;
}
};
Example function()
{
Example temp;
return temp;
}
int main()
{
Example p = function();
return 0;
}
-
- N::N(N const & )
- N
- N::operator=(N const &)
- N::N()
- None of these
Correct Option: D
As we are passing the object without any attributes it will return as N::N().