Skip to content

Commit d9f00fa

Browse files
authored
Update user.h
Finish assign5
1 parent 453d62c commit d9f00fa

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

assign5/user.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,33 @@ class User
1414
std::string get_name() const;
1515
size_t size() const;
1616
void set_friend(size_t index, const std::string& name);
17-
friend std::ostream& operator<<(std::ostream& os, const User& u);
18-
19-
/**
17+
/**
2018
* STUDENT TODO:
2119
* Your custom operators and special member functions will go here!
2220
*/
23-
~User();
21+
// friend function -> use public and private
22+
friend std::ostream& operator<<(std::ostream& os, const User& u);
23+
// Special Member Function
24+
// Destructor
25+
~User();
26+
// Copy Constructor
2427
User(const User& user);
25-
User& User::operator=(const User& user);
26-
User::User(User&& user) noexcept;
27-
User& User::operator=(User&& user) noexcept;
28-
User& User::operator+=(const User& user);
29-
bool User::operator<(const User& user) const;
28+
// Copy Assignment Operator
29+
User& operator=(const User& user);
30+
// Move Constructor
31+
User(User&& user) = delete;
32+
// Move Assignment Operator
33+
User& operator=(User&& user) = delete;
34+
// Object += Another object, Another Object += Object
35+
User& operator+=(User& user);
36+
// Object.size() (<,>,=) Another Object.size()
37+
bool operator<(const User& user) const;
38+
39+
// Member element
3040

3141
private:
3242
std::string _name;
3343
std::string* _friends;
3444
size_t _size;
3545
size_t _capacity;
36-
};
46+
};

0 commit comments

Comments
 (0)