#include <iostream>
using namespace std;

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

};

class DerivedDevice : public BaseDevice {
public:
      void setId(int arg) {
            this->id = arg;
      }
      void printId(void) {
            std::cout << "Device ID: " << id << std::endl;
      }
      // your code here: implement setId() and printId()

};

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

Input

Expected Output

Device ID: 101