A wrong question in Sololearn game (C++)?
I got the following question in Sololearn game: A derived class doesn't inherit access to which of the followings of a base class? (+) Private data (+) Friend functions (-) Protected data (+) Overloaded operators Answer #1: I agree, a derived class can not access to private data of a base class. Answer #2: friend functions for classes is usual functions: if a function was defined before use it may be used. Vice versa, friend functions have access to all class data. So, an inheritance can't change an access to friend functions from a class. I think that the author of the question meant that base class friend functions don't have access to derived class data. If so, I agree, but think it is better to rewrite the answer#2 or the question. Answer #3: I agree, a derived class can access to protected data of a base class. Answer #4: I disagree. Here, I can't guess what the author meant. Overloaded operators that were declared as class methods are inherited according their access specifiers (only protected and public). In that case, the answer#4 is wrong. Overloaded operators that were declared as standalone functions don't belong to the class, and so, access to them is defined as to a usual function (if it was declared before use, it may be used). In that case, answer#4 is also wrong. What do you think? P.S. I marked it as wrong 2 or 3 weeks ago, but got it again. Appologize in advance to the author of the question, if I was wrong.