f is only a friend of derived, not of base, so you still can't call base class members. If you had defined a new operator = in derived you should be able to call operator =.
If you put it into protected, then derived can access it and thus you don't need a new operator =.
Because you haven't defined an operator = in the derived class. Because of that, the default automatically calls the base class(es)'s operator = as well as using it to set all of the elements.
i just want to be clear, the private data of the base class is inherited by the derived class but however there is no way derive member can access it. so lets say i have :
can anyone let me know if a base class is inherited, so would the private data members. Hence in that case do we have to also do an assignment of them if we do a copy assignment of the derived class?
eg:
the code above continued:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
PriorityCustomer&
PriorityCustomer::operator=(const PriorityCustomer& rhs)
{
logCall("PriorityCustomer copy assignment operator");
priority = rhs.priority;
customer::operator=(rhs);//added, do we need to do this, why or why not
return *this;
}
rhs means right hand side...since it depicts the right hand side of the operator...and usually the left hand side is the calling function. Hope tat answers
Yes, you would because you can't access the private members directly...that is generally why base class members are made protected rather than private.