-
What is the output of this program?
#include <iostream>
using namespace std;
class N
{
public:
N(int k = 0){ _k = k;}
void fun()
{
cout << "Program Executed..."<}
private:
int _k;
};
int main()
{
N *ptr = 0;
ptr -> fun();
}
-
- Program Executed...
- Compilation Error
- Runtime Error
- Garbage value
- None of these
Correct Option: A
In this program, We passes the value to the class and printing it.