Guest User

Untitled

a guest
Oct 15th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. /**
  2. * ar_user.h
  3. * CodeTests 0x01
  4. *
  5. * Copyright (C)2012, Dwight Spencer (Denzuko) <dspencer@denzuko.co.cc>
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  23. * IN THE SOFTWARE.
  24. */
  25. #ifndef _AR_USER_H_
  26. namespace ActiveRecord {
  27. class User {
  28. private:
  29. string first_name,
  30. last_name,
  31. password;
  32.  
  33. public:
  34. void User();
  35.  
  36. // attr_writers
  37. void first_name(string);
  38. void last_name(string);
  39. void password(string);
  40.  
  41. // attr_readers
  42. string full_name();
  43. string first_name();
  44. string last_name();
  45. string password();
  46. }
  47.  
  48. void User::User() {
  49. this.first_name = "Joe";
  50. this.last_name = "Hacker";
  51. this.password = "crackme";
  52. }
  53.  
  54. void User::User(string fname, string lname, string pwd) {
  55. this.first_name = fname;
  56. this.last_name = lname;
  57. this.password = pwd;
  58. }
  59.  
  60. string User::full_name() {
  61. return this.first_name << " " << this.last_name;
  62. }
  63.  
  64. void User::first_name(first_name) {
  65. // test first_name.len < 127;
  66. this.first_name = first_name;
  67. }
  68.  
  69. void User::last_name(last_name) {
  70. // test last.len < 127;
  71. this.last_name = last_name;
  72. }
  73.  
  74. void User::password(password) {
  75. // do some hashing here
  76. this.password = password;
  77. }
  78. }
  79. #endif
Add Comment
Please, Sign In to add comment