-
What is the output of this program?
#include <iostream>
using namespace std;
class Abhay
{
public:
int age;
};
int main()
{
Abhay obj;
obj.age = 24;
cout << "Abhay is " ;
cout << obj.age << " years old.";
}
-
- years old.
- 24
- Abhay is
- Abhay is 24 years old.
- None of these
Correct Option: D
In this program, We passed the value from main function to class and returning it to the main and then printing it.