Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef REQUESTAREA_H
- #define REQUESTAREA_H
- class RequestArea
- {
- private:
- std::string name;
- int startArea;
- int endArea;
- enum accessType { read, write };
- accessType type;
- public:
- RequestArea();
- ~RequestArea();
- void setRequest(std::string name, int startArea, int endArea, accessType type);
- void getRequest();
- protected:
- };
- #endif // REQUESTAREA_H
- #include "RequestArea.h"
- RequestArea::RequestArea()
- {
- name = "";
- startArea = 0;
- endArea = 0;
- type = read;
- }
- void setRequest(std::string name, int startArea, int endArea, accessType type)
- {
- this->name = name;
- if(startArea < endArea)
- {
- this->startArea = startArea;
- this->endArea = endArea;
- }
- else
- {
- cout << "Error in area!";
- return 0;
- }
- this->type = type;
- }
- void getRequest()
- {
- cout << "name: " << name << endl;
- cout << "startArea: " << startArea << endl;
- cout << "endArea: " << endArea << endl;
- cout << "access type is: " << type << endl << endl;
- }
- RequestArea::~RequestArea()
- {
- cout << "Destructor";
- }
- #include <iostream>
- #include <RequestArea.h>
- using namespace std;
- int main()
- {
- RequestArea area;
- area.setRequest("name", 54, 128, read);
- area.getRequest();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement