All submissions

Object Pointer Access

#include <iostream>
using namespace std;

class Sensor {
public:
    int value;
    void setValue(int i)
    {
        value=i;
    }
    void printValue() {
        cout << "Sensor Value: " << value << "\n";
    }
};

int main() {
    Sensor s;
    s.setValue(88);
    s.printValue();
    return 0;
}
Loading...

Input

Expected Output

Sensor Value: 88