-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatUser.cpp
More file actions
85 lines (74 loc) · 1.46 KB
/
ChatUser.cpp
File metadata and controls
85 lines (74 loc) · 1.46 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "ChatUser.h"
#include <iostream>
using namespace std;
ChatUser::ChatUser()
{
//username = nullptr;
password = NULL;
friends = new string[0];
friendscounter = NULL;
}
ChatUser::ChatUser(string _username, int _password, string *_friends, int _friendscounter)
{
username = _username;
password = _password;
friendscounter = _friendscounter;
friends = new string[friendscounter];
for (auto i = 0; i < friendscounter; i++)
{
friends[i] = _friends[i];
}
}
ChatUser::ChatUser(ChatUser& ob)
{
username = ob.username;
password = ob.password;
friendscounter = ob.friendscounter;
friends = new string[friendscounter];
for (auto i = 0; i < friendscounter; i++)
{
friends[i] = ob.friends[i];
}
}
void ChatUser::Show()const
{
cout << "\n * * * \n";
cout << "* Username: " << username;
cout << "\n* Password: " << password;
cout << "\n* Friends: \n";
for (auto i = 0; i < friendscounter; i++)
{
cout << " " <<friends[i] << '\n';
}
//cout << '\n';
}
void ChatUser::setUsername(string _username)
{
username = _username;
}
void ChatUser::setPassword(int _password)
{
password = _password;
}
string ChatUser::getUsername()const
{
return username;
}
int ChatUser::getPassword()const
{
return password;
}
void ChatUser::setFriendsCounter(int _friendscounter)
{
_friendscounter = _friendscounter;
}
int ChatUser::getFriendsCounter()const
{
return friendscounter;
}
ChatUser::~ChatUser()
{
//username = nullptr;
password = NULL;
delete[]friends;
}