File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef TEST_H
2
+ #define TEST_H
3
+
4
+ /*
5
+ @Author:Jie Mo
6
+ @Email:582865471@vip.qq.com
7
+ @Time:13th October
8
+ @Github:www.github.com/JieTrancender
9
+ */
10
+
11
+ #include < iostream>
12
+
13
+ // MTC stand for My Test Class
14
+ namespace MTC
15
+ {
16
+ class PC
17
+ {
18
+ public:
19
+ PC () : m_user(" Admin" ), m_password(" 123456" ) {};
20
+ PC (std::string user, std::string password) : m_user(user), m_password(password) {};
21
+ PC & operator = (const PC &pc)
22
+ {
23
+ m_user = pc.m_user ;
24
+ m_password = pc.m_password ;
25
+ return *this ;
26
+ }
27
+ bool operator ==(const PC pc) const
28
+ {
29
+ return m_user == pc.m_user && m_password == pc.m_password ? true : false ;
30
+ }
31
+ bool operator !=(const PC &pc) const
32
+ {
33
+ return m_user != pc.m_user && m_password != pc.m_password ? true : false ;
34
+ }
35
+
36
+ friend std::ostream &operator << (std::ostream &os, const PC &pc);
37
+
38
+ private:
39
+ std::string m_user;
40
+ std::string m_password;
41
+ };
42
+
43
+ std::ostream &operator << (std::ostream &os, const PC &pc)
44
+ {
45
+ os << pc.m_user << " " << pc.m_password << std::endl;
46
+ return os;
47
+ }
48
+ }
49
+
50
+ #endif // test.hpp
You can’t perform that action at this time.
0 commit comments