-
What is the output of this program?
#include <iostream>
using namespace std;
class Lamborghini
{
public:
int speed;
};
int main()
{
int Lamborghini :: *ptrSpeed = &Lamborghini :: speed;
Lamborghini obj;
obj.speed = 4;
cout << obj.speed << endl;
obj.*ptrSpeed = 5;
cout << obj.speed << endl;
return 0;
}
-
- 4
- 5
- 5
4 - 4
5 - None of these
Correct Option: D
In this program, We are printing the value by direct access and another one by using pointer to member.