All submissions
#include <iostream>
using namespace std;

class BaseDevice {
protected:
      // your code here: declare protected int id
      int id;
};

class DerivedDevice : public BaseDevice {
public:
      void setId(int v);
      void printId(void);
      // your code here: implement setId() and printId()

};

void DerivedDevice::setId(int v){
      id = v; 
}

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



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

Input

Expected Output

Device ID: 101