Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. //#ifndef AHREF_EMPLOYEE
  2. //#define AHREF_EMPLOYEE
  3. //#pragma once
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. class Employee{
  8. protected:
  9.         static int enextID;
  10. private:
  11. int ID;
  12. string username;
  13. string password;
  14. bool manager;
  15.  
  16.  
  17. public:
  18.     Employee(string username,string password,bool manager){
  19.                 ID = enextID++;
  20.                 this->username = username;
  21.                 this->password = password;
  22.                 this->manager = manager;
  23.         }
  24.         ~Employee(){enextID--;}
  25.         void Employee::grantManager(){
  26.                 this->manager = true;
  27.         }
  28.         void Employee::revokeManager(){
  29.                 this->manager = false;
  30.         }
  31.         string Employee::getUsername(){
  32.                 return username;
  33.         }
  34.         string Employee::getPassword(){
  35.                 return password;
  36.         }
  37.         bool Employee::getAccess(){
  38.                 return manager;
  39.         }
  40.  
  41.         int Employee::getID(){
  42.             return ID;
  43.         }
  44. };
  45.  int Employee::enextID = 0;
  46.  
  47.  int main(){
  48.      Employee test("kira", "zaki", false);
  49.      Employee test2("zaki", "kira", true);
  50.      cout << test.getID() << endl;
  51.      cout << test2.getID() << endl;
  52.  
  53.      int i = 0;
  54.      cin >> i;
  55.      return 0;
  56.  }
  57. //#endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement