Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * ar_user.h
- * CodeTests 0x01
- *
- * Copyright (C)2012, Dwight Spencer (Denzuko) <dspencer@denzuko.co.cc>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
- #ifndef _AR_USER_H_
- namespace ActiveRecord {
- class User {
- private:
- string first_name,
- last_name,
- password;
- public:
- void User();
- // attr_writers
- void first_name(string);
- void last_name(string);
- void password(string);
- // attr_readers
- string full_name();
- string first_name();
- string last_name();
- string password();
- }
- void User::User() {
- this.first_name = "Joe";
- this.last_name = "Hacker";
- this.password = "crackme";
- }
- void User::User(string fname, string lname, string pwd) {
- this.first_name = fname;
- this.last_name = lname;
- this.password = pwd;
- }
- string User::full_name() {
- return this.first_name << " " << this.last_name;
- }
- void User::first_name(first_name) {
- // test first_name.len < 127;
- this.first_name = first_name;
- }
- void User::last_name(last_name) {
- // test last.len < 127;
- this.last_name = last_name;
- }
- void User::password(password) {
- // do some hashing here
- this.password = password;
- }
- }
- #endif
Add Comment
Please, Sign In to add comment