Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

4
[C++] Is there any way to compare a value to a protected value?
Post Body

I'm working on an assignment that implements a university with Departments, Students, Faculties, ect. I'm still fairly new to programing and I'm stuck at trying to run an if statement that runs if the two values are identical. This is the function I'm trying to work with;

bool University::RemoveADepartment(long depId)
{
    for (int i = 0; i < Departments.size(); i  ) // Departments is a Vector of type Department class
    {
        if (Departments[i].ID == depId) // ID is a protected member of Department class
        {
            Departments.erase(Departments.begin()   i);
            return success;
        }
    }
    cout << "Department ID was not found to delete." << endl;
    return failure;
}

Aside from turning ID into a public member, how would I go about comparing depID to the Department::ID?

Author
Account Strength
80%
Account Age
14 years
Verified Email
No
Verified Flair
No
Total Karma
9,120
Link Karma
1,446
Comment Karma
7,674
Profile updated: 6 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
11 years ago