-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lab_06.cpp
54 lines (44 loc) · 1.45 KB
/
Lab_06.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <string>
using namespace std;
class Device
{
public:
Device(std::string const model, int systemID, bool isConnected)
{
m_model = model;
m_systemID = systemID;
m_isConnected = isConnected;
}
std::string getModel()
{
return m_model;
}
int getSystemID()
{
return m_systemID;
}
bool getConnStatus()
{
return m_isConnected;
}
void setModel(std::string const model) { m_model = model; }
void setSystemID(int systemID) { m_systemID = systemID; }
void setConnStatus(bool isConnected) { m_isConnected = isConnected; }
protected:
std::string m_model;
private:
int m_systemID = 0;
bool m_isConnected = false;
};
int main()
{
Device myDevice1("INTR-202245", 0x245);
std::cout << "Device 1 Model: " << myDevice1.getModel() << "\n";
std::cout << "Device 1 System ID: " << myDevice1.getSystemID() << "\n";
std::cout << "Device 1 is connected: " << myDevice1.getConnStatus() << "\n";
Device myDevice2("INTR-202246", 0x245, true);
std::cout << "Device 2 Model: " << myDevice2.getModel() << "\n";
std::cout << "Device 2 System ID: " << myDevice2.getSystemID() << "\n";
std::cout << "Device 2 is connected: " << myDevice2.getConnStatus() << "\n";
}