-
What is the output of this program?
#include
using namespace std;
class num
{
int N;
public:
int getN();
void putN(int M);
};
int num::getN()
{
return N;
}
void num::putN(int M)
{
N = M;
}
int main()
{
num obj;
obj.putN(15);
cout << obj.getN( );
return 0;
}
-
- Compilation Error
- Runtime Error
- Garbage Value
- 15
- None of these
Correct Option: D
We are getting the number and copying it to M and printing it.