From 945f7e67d6ca8047c961457786fac5e2d9a13d82 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 3 Apr 2026 18:17:51 +0300 Subject: feat(Week07): Add solutions --- Week07/Exercise01/User.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Week07/Exercise01/User.h (limited to 'Week07/Exercise01/User.h') diff --git a/Week07/Exercise01/User.h b/Week07/Exercise01/User.h new file mode 100644 index 0000000..7e04560 --- /dev/null +++ b/Week07/Exercise01/User.h @@ -0,0 +1,45 @@ +#ifndef _USER +#define _USER + +#include "String.h" +#include "Book.h" + +class User { + String email; + String password; + unsigned bankCard; + + // Масив от указатели към книги + const Book** library; + unsigned libraryCount; + unsigned libraryAlloc; + + void copyFrom(const User& other); + void free(); + + void resizeLibrary(); + +public: + User(); + ~User(); + User(const User& other); + User& operator=(const User& other); + User(User&& other); + User& operator=(User&& other); + + void SetEmail(const String& newEmail); + const String& GetEmail() const; + + void SetPassword(const String& newPassword); + + bool Login(const String& email, const String& password); + + void AddBookToLibrary(const Book* book); + void ListLibrary(); + const Book* GetBook(unsigned index) const; + + void SetBankCard(unsigned newBankCard); + unsigned GetBankCard() const; +}; + +#endif /* _USER */ -- cgit v1.3.1-23-gd82d