#include <iostream>
using namespace std;

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

};

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

      }

};

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

Input

Expected Output

Device ID: 101