Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "User.h"
  2.  
  3. User::User() : name(nullptr),password(nullptr){}
  4. User::User(const char* _name, const char* _password) {
  5.     name = nullptr;
  6.     password = nullptr;
  7.     setName(_name);
  8.     setPassword(_password);
  9. }
  10. User::~User(){
  11.     delete[] name;
  12.     delete[] password;
  13. }
  14. User::User(const User& other) {
  15.     setName(other.getName());
  16.     setPassword(other.getPassword());
  17. }
  18. User& User::operator=(const User& other) {
  19.     if (this == &other) {
  20.         return *this;
  21.     }
  22.     setName(other.getName());
  23.     setPassword(other.getPassword());
  24.     return *this;
  25. }
  26. void User::setName(const char* _name) {
  27.     delete[]name;
  28.     name = new char[strlen(_name) + 1];
  29.     strcpy_s(name,strlen(_name)+1, _name);
  30. }
  31. void User::setPassword(const char* _password) {
  32.     delete[]password;
  33.     password = new char[strlen(_password) + 1];
  34.     strcpy_s(password,strlen(_password)+1, _password);
  35. }
  36. const char* User::getName()const {
  37.     return name;
  38. }
  39. const char* User::getPassword()const {
  40.     return password;
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top