All submissions
#include <iostream>
using namespace std;

class BaseDevice {
protected:

      // your code here: declare protected int id
      int id;

};

class DerivedDevice : public BaseDevice {
public:

      // your code here: implement setId() and printId()
      void setId(int id)
      {
            DerivedDevice::id = id;
      }

      void printId(void)
      {
            cout<<"Device ID: "<<DerivedDevice::id;
      }     

};

int main() {
   DerivedDevice d;
   d.setId(101);
   d.printId();
   return 0;
}
Loading...

Input

Expected Output

Device ID: 101