-
Notifications
You must be signed in to change notification settings - Fork 2
/
User.hpp
36 lines (29 loc) · 801 Bytes
/
User.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _USER_H_
#define _USER_H_
#include <list>
#include <string>
#include <iostream>
//delicious enums outside a namespace
enum Gender {GENDER_NA, GENDER_MALE, GENDER_FEMALE};
enum Age {AGE_NA, AGE_TEEN, AGE_YOUNG, AGE_OLD};
class IUser
{
public:
virtual ~IUser() {}
virtual Gender getGender() const = 0;
virtual Age getAge() const = 0;
virtual std::list<std::string> getBrowsingHistory() const = 0;
};
class User : public IUser
{
public:
virtual ~User();
User(char gender, int age);
virtual Gender getGender() const { std::cout << "get gender" << std::endl; return gender_; }
virtual Age getAge() const { std::cout << "get age" << std::endl; return age_; }
std::list<std::string> getBrowsingHistory() const;
private:
Gender gender_;
Age age_;
};
#endif /* _USER_H_ */