Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor #22

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UserData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ UserData::~UserData() {
_strRole = "";
}

int UserData::userAge(std::string dateOfBirth) {
int UserData::userAge(std::string dateOfBirth) const {
int iAge = 0;
time_t currentTime = time(0);

Expand Down
15 changes: 8 additions & 7 deletions UserData.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ class UserData {
std::string _strPassword;
std::string _strRole;

/**
* @brief Calculates the age of the user
* @details This function calculates the age of the user based on the date of birth.
* @param dateOfBirth The date of birth of the user (format: DD/MM/YYYY)
* @return The age of the user
*/
int userAge(std::string dateOfBirth) const;

public:
/**
* @brief Constructs a new User object with the provided data.
Expand Down Expand Up @@ -83,13 +91,6 @@ class UserData {

// void setRole(std::string role);

/**
* @brief Calculates the age of the user
* @details This function calculates the age of the user based on the date of birth.
* @return void
*/
int userAge(std::string dateOfBirth);

/**
* @brief Overloads the != operator
* @details This function overloads the != operator to compare two users.
Expand Down
Loading