if(this->age < p.age) return false;
p.age: age is private, and can access like this because this line is inside the method of class, so it can access all private member.
if you put p.age
outside method of class, it will notice error. For example:
int main()
{
Person p("Hello, world!", 23);
// will be error, because main is not inside class People
if (p.age < 18) {
cout << "You are not adult" << endl;
}
return 0;
}
Hope this help :)